我曾经编辑 GDM 的启动脚本 (/etc/gdm/Init/Default) 以永久更改我的显示分辨率。
如何在 Ubuntu Oneiric 中使用 LigthDM 执行此操作?
小智 65
修改/etc/lightdm/lightdm.conf添加以下选项:
display-setup-script >mycustomloginvideo.sh在登录屏幕出现之前
调用您session-setup-script >mycustomdesktopvideo.sh在用户桌面会话开始之前调用您
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
# for your login screen, e.g. LightDM (Ubuntu 11.10) or GDM (11.04 or earlier)
display-setup-script=/usr/share/mycustomloginvideo.sh
# for your desktop session
session-setup-script=/usr/share/mycustomdesktopvideo.sh
Run Code Online (Sandbox Code Playgroud)
您可能使用“ arandr” GUI 工具生成上述 sh 脚本,从当前会话的 X 配置中选取参数。
确保您的 shell 脚本是可执行的:
chmod a+x /usr/share/mycustom*video.sh
Run Code Online (Sandbox Code Playgroud)
并且您可以xrandr通过在终端中运行它来测试它是否有效(即您的命令中没有任何拼写错误或配置错误):
/usr/share/mycustomdesktopvideo.sh
Run Code Online (Sandbox Code Playgroud)
如果登录脚本由于任何原因不起作用,您的机器可能无法完成到登录屏幕的引导过程。如果桌面脚本失败,登录后可能无法获得桌面。如果设置外接显示器,断开连接时这些脚本将失败,并且无法启动X session。
Nim*_*ehr 25
我认为您可以将显示模式添加到/etc/X11/xorg.conf.
如果您没有xorg.conf,则可以使用以下内容作为基础。您需要替换条目与名称Modeline,Driver并Modes为您的系统的正确条目。根据您的硬件,您可能需要额外的条目,例如,如果您的系统有多个图形芯片。
Section "Monitor"
Identifier "Monitor0"
Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
Modeline "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Modes "1280x1024_60.00" "1024x768_60.00"
EndSubSection
EndSection
Section "Device"
Identifier "Card0"
Driver "nvidia"
EndSection
Run Code Online (Sandbox Code Playgroud)
如果您不知道系统正在使用的视频驱动程序的名称,那么您可能会得到如下名称(如果您有英特尔图形芯片,驱动程序名称只是“intel”):
lshw -class display | grep "driver"
Run Code Online (Sandbox Code Playgroud)
可以使用以下方式生成模型线cvt:
cvt <h-resolution> <v-resolution> [refresh]
Run Code Online (Sandbox Code Playgroud)
小智 11
有人发布了另一种解决方法,尽管我必须说它对我不起作用。它可能对你有用。就我而言,它破坏了统一性,我只能四处移动鼠标光标。应用程序指示器顶部面板看起来是空的,但在拔下 LCD 后,我能够删除添加的行,一切都恢复正常。
编辑文件 /usr/sbin/lightdm-session
这是该文件的第一部分现在的样子:
#!/bin/sh
#
# LightDM wrapper to run around X sessions.
echo "Running X session wrapper"
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
if [ -f "$file" ]; then
echo "Loading profile from $file";
. "$file"
fi
done
xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode CRT1 1368x768_60.00
xrandr --output CRT1 --mode 1368x768_60.00
# Load resources
Run Code Online (Sandbox Code Playgroud)
请注意,应更改 Xrandr 设置以匹配您的设置。
小智 6
一段时间以来,我一直在尝试解决类似的问题,并找到了一个对我有用的解决方案,因此希望它会有所帮助...
我有一台旧的 AOA110,我的屏幕损坏了太多次,在购买了一台新笔记本电脑后,我决定尝试将其变成 HTPC,但 X 无法识别我拥有的外接显示器,因此我不得不这样做多次“调整”它以使其以正确的分辨率工作。
这是我所做的:
在使用这个http://ubuntuforums.org/showthread.php?t=1112186教程到第 5 步之后,我能够在 xrandr 中找到一个有效且可接受的分辨率,但这在 LightDM 登录屏幕上不起作用。
不要按照上面的步骤使其持久化它可能会如何工作,但我认为这是在 11.10 中执行此操作的正确方法。我在 ArchWiki https://wiki.archlinux.org/index.php/Xorg上找到了这篇文章,我根据自己的需要进行了调整。
首先在这里创建一个文件: /etc/X11/xorg.conf.d/10-monitor.conf
然后为您的显示器添加适当的 X 详细信息,这是我的外观:
Section "ServerLayout"
Identifier "DualSreen"
Screen 0 "Screen0"
Screen 1 "Screen1" RightOf "Screen0" #Screen1 at the right of Screen0
#Option "Xinerama" "1" #To move windows between screens
EndSection
Section "Monitor"
Identifier "LVDS1"
Option "ignore" "true"
EndSection
Section "Monitor"
Identifier "VGA1"
Option "Enable" "true"
Modeline "1440x900_60.00" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
EndSection
Section "Device"
Identifier "Device0"
Driver "intel"
Screen 0
EndSection
Section "Device"
Identifier "Device1"
Driver "intel"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "VGA1"
DefaultDepth 24
Option "TwinView" "0"
SubSection "Display"
Depth 24
Modes "1440x900_60.00"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "LVDS1"
DefaultDepth 24
Option "TwinView" "0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Run Code Online (Sandbox Code Playgroud)
要添加的重要位在适当的Section "Monitor"包括Modeline您在使用时找到的适当的,gtf 1440 900 60.00然后在相应的Section "Screen"包括正确的Modes.
您会注意到我所做的不仅是将 VGA1 连接设置为合适的分辨率,而且还告诉它不要使用我的 LVDS1 输出。显然,您需要适当调整您的设置,以匹配正确数量的输出以及适合您设置的正确设备、屏幕和显示部分。
很抱歉这篇史诗般的帖子,我一直在使用 Hannspree 显示器调整 xorg.conf 文件一段时间,而我在 11.10 之前使用的旧 xorg.conf 设置不再正常工作,这是我发现唯一可行的解决方案。
祝你好运!
小智 5
我的笔记本电脑遇到了与上述类似的问题,我想在对话中添加一些内容。如果您不关心登录分辨率(我不关心),但希望实际工作区具有正确的分辨率,您可以将监视器信息添加到 LightDM,但在登录之前不要打开全分辨率。
我刚刚在文件中为我的监视器添加了以下脚本: lighdmxrandr
xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
xrandr --addmode VGA1 1440x900_60.00
Run Code Online (Sandbox Code Playgroud)
然后我调用它 /etc/lightdm/lightdm.conf
display-setup-script=/usr/bin/lightdmxrandr
Run Code Online (Sandbox Code Playgroud)
一旦我登录,我就可以在 Displays 中设置我的显示器并且它可以工作,即使在我重新登录之后也是如此(过去常常给我一个很大的丑陋错误)。