How*_*ods 6 xrandr xubuntu display multiple-monitors lenovo
我真的很想在插入我的显示器后自动应用我的显示设置(当前使用 xrandr 管理)。我认为这可以用 Bash 脚本来完成,但是我还没有找到一种方法来从终端获取显示设置的句柄。
连接 HDMI 外接显示器后,我必须使用“显示设置”GUI 来激活和配置显示器。这没什么大不了的,除了检查“使用此输出”并不总是第一次(弹出“保持此配置”对话框,但显示仍处于非活动状态),我必须使用“高级”设置重新排列两个显示器,每次我从睡眠中唤醒机器时都必须这样做。
我想研究使用 xrandr 编写其中一些设置的脚本,但我无法让 xrandr 命令在 HDMI 显示器上工作。
$ xrandr --output HDMI1 --mode 1920x1080
Run Code Online (Sandbox Code Playgroud)
..闪烁内置显示器并弹出显示设置 GUI(如果在 GUI 中选中“连接时配置新显示器”,则闪烁输出,否则不执行任何操作)。
xrandr -d :0 output HDMI1 --auto
Run Code Online (Sandbox Code Playgroud)
做同样的事情。我也试过'arandr' GUI。不确定它运行什么命令,但它们也做同样的事情。
xrandr 输出:
Screen 0: minimum 8 x 8, current 3520 x 1346, maximum 32767 x 32767
LVDS1 connected primary 1600x900+0+446 (normal left inverted right x axis y axis) 294mm x 166mm
1600x900 60.1*+
1440x900 59.9
1360x768 59.8 60.0
1152x864 60.0
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected 1920x1080+1600+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920x1080 60.0*+ 50.0 59.9
1680x1050 59.9
1280x1024 60.0
1440x900 59.9
1280x800 59.9
1152x864 75.0
1280x720 60.0 50.0 59.9
1024x768 70.1 60.0
800x600 60.3 56.2
720x576 50.0
720x480 60.0 59.9
640x480 66.7 60.0 59.9
720x400 70.1
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Run Code Online (Sandbox Code Playgroud)
编辑:使用 gui 调整之前的 xrandr 输出:
(不确定它是否相关,但如果我插入显示器并且不立即配置,则 xfce4-display-settings guis/processes 开始每隔几秒钟无休止地弹出。电源管理“x 分钟后空白”开始了昨天插入了不同的 hdmi 显示器,当我恢复使用时,大约有 50 个“显示器”窗口打开。)
Screen 0: minimum 8 x 8, current 1600 x 900, maximum 32767 x 32767
LVDS1 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 294mm x 166mm
1600x900 60.1*+
1440x900 59.9
1360x768 59.8 60.0
1152x864 60.0
1024x768 60.0
800x600 60.3 56.2
640x480 59.9
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 connected (normal left inverted right x axis y axis)
1920x1080 60.0 + 50.0 59.9
1680x1050 59.9
1280x1024 60.0
1440x900 59.9
1280x800 59.9
1152x864 75.0
1280x720 60.0 50.0 59.9
1024x768 70.1 60.0
800x600 60.3 56.2
720x576 50.0
720x480 60.0 59.9
640x480 66.7 60.0 59.9
720x400 70.1
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Run Code Online (Sandbox Code Playgroud)