Linux下雙屏顯示的設置

版權所有:晴耕雨讀@【牧碼志】,如需轉載,請注明出處。
原文地址:http://sinolog.it/?p=2101

RandR是對X11的一個擴展協議,允許在不重啟X的情況下修改輸出的一些參數並使之生效,xrandr是該協議的命令行界面,它的功能之一就是用來設置雙屏顯示。

缺省情況下,外接顯示器後啟用的是屏幕複製模式,即兩個屏幕顯示完全相同的內容。使用命令xrandr -q查看當前的輸出狀態:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
LVDS1 connected 1280×800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm
1280×800 60.0+ 60.0 50.0
1024×768 75.1 70.1 60.0
800×600 72.2 75.0 60.3 56.2
768×576 75.0 72.0 60.0
640×480 72.8 75.0 60.0 59.9
VGA1 connected 1920×1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920×1080 60.0
+
1680×1050 60.0
1280×1024 75.0 60.0
1440×900 59.9
1280×960 60.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 66.7 60.0
720×400 70.1
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)

可見,筆記本電腦的屏幕輸出(LVDS1)的顯示分辨率是1280×800,外接顯示器的輸出(VGA1)的分辨率是1920×1080。兩個輸出在整個虛擬屏幕(名稱:Screen 0;當前大小:1920×1080;最大:8192×8192)上的坐標都是+0+0。所以在外接顯示器中可以看到屏幕左上角有一個1280×800分辨率的小屏幕。

屏幕複製模式最常用於外接投影儀,現在我需要兩個屏幕分別顯示在各自的顯示器中,並在兩個屏幕中顯示不同的內容(也就是Windows下設置雙屏顯示時選擇的擴展模式)。

由於我將筆記本電腦放在外接顯示器的左邊,所以為了操作的自然,使用命令xrandr --output VGA1 --right-of LVDS1將外接顯示器的輸出在虛擬屏幕上的位置設置在筆記本電腦的輸出的右邊,示意圖如下:

Linux下雙屏顯示的設置_第1张图片

這樣,兩個顯示器中就可以顯示不同的內容了。由於屬於同一個虛擬屏幕,當然也可以將一個窗口跨過邊界從一個顯示器拖到另一個顯示器中。再使用命令xrandr -q查看現在的輸出狀態:

Screen 0: minimum 320 x 200, current 3200 x 1080, maximum 8192 x 8192
LVDS1 connected 1280×800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm
1280×800 60.0+ 60.0 50.0
1024×768 75.1 70.1 60.0
800×600 72.2 75.0 60.3 56.2
768×576 75.0 72.0 60.0
640×480 72.8 75.0 60.0 59.9
VGA1 connected 1920×1080+1280+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920×1080 60.0
+
1680×1050 60.0
1280×1024 75.0 60.0
1440×900 59.9
1280×960 60.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 66.7 60.0
720×400 70.1
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)

使用xrandr做的設置只對當前的X會話有效,重啟後恢復原樣。使設置持久化的方法為修改xorg.conf或設置自動執行命令。據說有一些圖形界面封裝的xrandr的前端,完善的桌面環境如GNOME和KDE應該也是可以在圖形界面中設置的,不過我所使用的XFCE目前似乎只能啟用/禁用複製模式,而不支持在圖形界面中設置擴展模式。

Posted via UltraBlog.vim.

您也许会对这些感兴趣

  • Dokan SSHFS:Windows下通過SSH挂載Linux主機為本地分區
  • darkstat: 網絡流量監測工具
  • 開啟自定義GTK程序菜單快捷鍵的方法
  • Arch不完全降溫筆記
  • 使用PAC Manager管理SSH連接

你可能感兴趣的:(linux)