我有一个三重监视器设置(xorg.conf 用 amdcccle 生成:http ://pastebin.com/gWSVEyLa )在 Arch Linux 上运行,Xmonad作为我的窗口管理器。从物理上讲,左侧有一个高清电视,中间有一个不错的戴尔显示器,右侧有一个旋转的显示器。因为我的 HDTV 只有一个 HDMI 输入,所以我在其他一些设备上使用了一个 4 输入、2 输出开关。我的 HDTV 并非始终处于连接状态,这会导致我的虚拟桌面的该部分被禁用。这会引起很多烦恼:
- 由于驱动程序的热插拔事件(基本上运行 xrandr --auto)导致屏幕闪烁烦人。
- 物理屏幕顺序已更改(hdtv 成为第三台显示器而不是第一台显示器),导致我专注于屏幕的键绑定错误。我已经使用我的 xmonad 配置解决了这个问题,但是当只检测到两个监视器时,绑定仍然会发生变化。
- 如果我在没有连接 HDTV 的情况下启动计算机,则虚拟桌面的该部分将无法使用,直到它在热插拔事件上连接或我运行 xrandr 以启用它。
- 断开连接的监视器上工作区中的 Windows 被移动到可见监视器上的其他工作区。这基本上意味着我的 HDTV 上显示的任何窗口都会被随机抛出,由于 Xmonad 处理工作区的方式,这是毫无意义的。
- 我无法将一两台显示器置于 dpms 待机状态或手动关闭显示器,
xrandr --off
因为其他显示器会吓坏了。例如,如果我只是用我的电视看东西,我不一定要打开另外两个显示器,但我希望它们的窗口位置保持不变。
当我在 HDMI 开关上切换输入或打开/关闭它,或物理断开电缆时,我的视频驱动程序会将其解释为断开我的显示器,并将其从我的虚拟桌面中删除。我希望 X 始终表现得好像所有三个监视器都已连接并且不响应任何监视器热插拔事件。Linux 能够使用完全自动的 xorg 配置是很棒的,但我一直想要这个精确的设置,直到我改变我的硬件。我的 xorg 日志中的热插拔事件如下所示:
When disconnected:
[ 1684.459] (II) fglrx(0): Hot-plug event occurs on device: 1:0:0
[ 1684.459] (II) fglrx(0): EDID vendor "DEL", prod id 40993
+-- 3 lines: [ 1684.459] (II) fglrx(0): Using hsync ranges from config file-----------------------------------------------------------------------------------------------------
+-- 11 lines: [ 1684.459] (II) fglrx(0): Modeline "1600x1200"x0.0 162.00 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync (75.0 kHz eP)----------------------------------
[ 1684.468] (II) fglrx(0): xdl_xs113_atiddxDisplayScreenEnableDisplays
[ 1684.468] (II) fglrx(0): User Preference Output DFP1 using refresh rate 60.0 Hz.
[ 1684.537] (II) fglrx(0): User Preference Output DFP10 using refresh rate 60.0 Hz.
When reconnected:
[ 1694.077] (II) fglrx(0): Hot-plug event occurs on device: 1:0:0
[ 1694.210] (II) fglrx(0): EDID vendor "DEL", prod id 40993
+-- 3 lines: [ 1694.210] (II) fglrx(0): Using hsync ranges from config file-----------------------------------------------------------------------------------------------------
+-- 9 lines: [ 1694.210] (II) fglrx(0): Modeline "1600x1200"x0.0 162.00 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync (75.0 kHz eP)----------------------------------
[ 1694.219] (II) fglrx(0): xdl_xs113_atiddxDisplayScreenEnableDisplays
[ 1694.219] (II) fglrx(0): User Preference Output DFP1 using refresh rate 60.0 Hz.
[ 1694.288] (II) fglrx(0): User Preference Output DFP9 using refresh rate 60.0 Hz.
[ 1694.359] (II) fglrx(0): User Preference Output DFP10 using refresh rate 60.0 Hz.
Run Code Online (Sandbox Code Playgroud)
我真的不关心热插拔,因为我使用的是 Xmonad 并且宁愿始终输出到这三个设备,无论它们是否被视为已连接。可能有一些方法可以配置视频驱动程序来执行我想要的操作,但是我不确定该选项是否存在并且还没有找到任何好的信息,所以我在这里问。如果这工作正常,这两个命令的输出将是相同的,除了关闭/打开 HDTV 外,不会在视觉上发生任何事情:
$ xrandr | grep 'DFP.* connected'
DFP1 connected 2560x1600+1920+0 (normal left inverted right x axis y axis) 641mm x 401mm
DFP9 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 708mm x 398mm
DFP10 connected 1200x1600+4480+0 left (normal left inverted right x axis y axis) 367mm x 275mm
$ xrandr --verbose --output 'DFP9' --off
screen 0: 3760x1600 994x423 mm 96.08dpi
crtc 0: 2560x1600 60.0 +0+0 "DFP1"
crtc 2: 1600x1200 60.0 +2560+0 "DFP10"
$ xrandr | grep 'DFP.* connected'
DFP1 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 641mm x 401mm
DFP9 connected (normal left inverted right x axis y axis)
DFP10 connected 1200x1600+2560+0 left (normal left inverted right x axis y axis) 367mm x 275mm
$ xrandr --verbose --output 'DFP9' --preferred --pos 0x0 --output 'DFP1' --preferred --pos 1920x0 --output DFP10 --preferred --pos 4480x0
screen 0: 5680x1600 1501x423 mm 96.08dpi
crtc 0: 2560x1600 60.0 +1920+0 "DFP1"
crtc 1: 1920x1080 60.0 +0+0 "DFP9"
crtc 2: 1600x1200 60.0 +4480+0 "DFP10"
$ xrandr | grep 'DFP.* connected'
DFP1 connected 2560x1600+1920+0 (normal left inverted right x axis y axis) 641mm x 401mm
DFP9 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 708mm x 398mm
DFP10 connected 1200x1600+4480+0 left (normal left inverted right x axis y axis) 367mm x 275mm
Run Code Online (Sandbox Code Playgroud)
小智 1
几周来我一直在努力解决这个问题。我得到的最好的结果是设置一个 xrandr 脚本,将显示及其位置设置为我想要的,并将该脚本绑定到键盘快捷键。这样,每当我关闭一台显示器或从睡眠中醒来时,我按下快捷键,所有显示器都会设置为我想要的。
我的脚本:
首先,我通过运行 xrandr 命令获取显示器的名称。对我来说,它们是 DP3.1、DP3.2 和 DP-4。
然后我用它们的分辨率和相对位置设置我的命令:
xrandr --output DP-3.1 --auto --output DP-3.2 --auto --right-of DP-3.1 --output DP-4 --auto --right-of DP-3.2
Run Code Online (Sandbox Code Playgroud)
如果 xrandr 简单地“记住”这些设置并且从不更改,那就更好了。当我的显示器从睡眠中醒来时,它会检测到它们已拔出电源并弄乱了一切,需要这个脚本,该脚本需要几秒钟的时间才能运行。