xrandr
使用两个显示器,笔记本的显示器临时关闭又打开的时候,有时候用Display Setting没有办法设置正确的显示模式。
首先直接运行xrandr命令,查看设备的相关信息。
运行之后会显示当前连接设备的屏幕信息,如下图,LVDS-1和HDMI-1屏幕在用,VGA-1、DP-1和DP-2屏幕为disconnect,意为没有连接:
Screen 0: minimum 320 x 200, current 2646 x 1024, maximum 8192 x 8192
LVDS-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm
1366x768 60.02*+
1360x768 59.80 59.96
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
960x600 60.00
960x540 59.99
800x600 60.00 60.32 56.25
840x525 60.01 59.88
800x512 60.17
700x525 59.98
640x512 60.02
720x450 59.89
640x480 60.00 59.94
680x384 59.80 59.96
576x432 60.06
512x384 60.00
400x300 60.32 56.34
320x240 60.05
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 1280x1024+1366+0 (normal left inverted right x axis y axis) 376mm x 301mm
1280x1024 60.02*+ 75.02 72.05
1152x864 75.00
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32
640x480 75.00 72.81 66.67 59.94
720x400 70.08
640x350 70.07
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
这时候只要关闭内置显示器就可以了。
xrandr --output LVDS-1 --off
二.设置双屏幕显示相关命令:
(1)打开外接显示器,双屏幕显示相同的内容--克隆,(auto为最高分辨率)
xrandr --output LVDS-1 --same-as HDMI-1 --auto
(2)若要指定外接显示器的分辨率可以使用下面的命令(1280*1024):
xrandr --output LVDS-1 --same-as HDMI-1 --mode 1280x1024
(3)打开外接显示器,设置为右侧扩展
xrandr --output HDMI-1 --right-of LVDS-1 --auto
(4)关闭内置显示器
xrandr --output LVDS-1 --off
(5)打开LVDS-1接口显示器,关闭HDMI-1接口显示器
xrandr --output LVDS-1 --auto --output HDMI-1 --off