Ven*_*hy6 13 xrandr lightdm display-resolution
我想将桌面屏幕分辨率更改为1366x768
. 但是我的VESA drivers(AMD REDWOOD)
没有检测到该分辨率。所以我创建了一个 shell 脚本,如下所示:-
xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode DVI-0 1368x768_60.00
xrandr --output DisplayPort-0 --off --output DVI-0 --mode 1368x768_60.00 --pos 0x0 --rotate normal --output HDMI-0 --off
Run Code Online (Sandbox Code Playgroud)
我将其保存为lightdmxrandr.sh
in/usr/bin
并使其可执行。然后我添加了以下几行/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
(这相当于众所周知的/etc/lightdm/lightdm.conf
。我正在使用上面的文件,因为我在 14.04 上没有/etc/lightdm/lightdm.conf
。):-
greeter-session=unity-greeter
display-setup-script=/usr/bin/lightdmxrandr.sh
session-setup-script=/usr/bin/lightdmxrandr.sh
Run Code Online (Sandbox Code Playgroud)
并保存了它。从理论上讲,这应该将登录屏幕分辨率和桌面屏幕分辨率都更改为1366x768
. 但令人惊讶的是,这仅更改了登录屏幕分辨率。桌面分辨率没有改变。后来我将脚本添加到启动应用程序,这改变了我的桌面分辨率。
所以我想知道为什么我对lightdm.conf
文件(或者更确切地说是50-ubuntu.conf
文件)所做的编辑没有影响我的桌面分辨率。这是某种必须在启动板上报告的错误,还是说 lightdm 中的编辑会影响桌面屏幕是错误的?
PS:- 在我看来,这不仅仅针对 Ubuntu 14.04。
ter*_*don 11
我尝试了类似的事情,经过一些调试后,我想我知道发生了什么。您的脚本可能已运行并且可能确实正确设置了分辨率。但是,由于它是由登录管理器运行的,因此它会在 Unity 完成设置您的桌面环境之前运行,并且 Unity 会读取自己的设置并将分辨率重置为您拥有的分辨率。所以,我认为发生的事情是:
现在,发生这种情况是因为 VESA 驱动程序没有自动检测到您想要的分辨率。这意味着当您从 Unity 设置的“显示”部分更改分辨率时,您会为其提供一个分辨率,除非您运行xrandr
命令,否则该分辨率不可用。因此,下次重新启动时会忽略此设置,Unity 将恢复为默认分辨率。
因此,您需要做的是让 Unity 可以使用该分辨率,然后将其设置为默认值并让它处理它。为此,您必须首先将此行添加到/usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
:
session-setup-script=/usr/bin/lightdmxrandr.sh
Run Code Online (Sandbox Code Playgroud)
然后,确保/usr/bin/lightdmxrandr.sh
看起来像这样:
xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
xrandr --addmode DVI-0 1368x768_60.00
Run Code Online (Sandbox Code Playgroud)
请注意,我实际上并没有设置分辨率,只是使其可用。完成此重新启动后,然后登录。现在应该可以在设置 => 显示中使用新的分辨率。如果是这样,请在那里选择它,注销并重新登录,分辨率应该设置正确。它现在应该在重新启动后保持不变。
创建一个/etc/X11/xorg.conf
列出所需分辨率的文件。像这样的东西:
Section "Monitor"
Identifier "Monitor0"
Modeline "1368x768_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Modes "1368x768_60.00"
EndSubSection
EndSection
Section "Device"
Identifier "Card0"
Driver "vesa"
EndSection
Run Code Online (Sandbox Code Playgroud)将运行xrandr
命令的脚本添加到会话的启动应用程序中。