我想在每次启动时配置笔记本电脑的2个外部屏幕.
因为我有一种码头站,我写了一个小脚本,检查我的笔记本电脑是否连接到扩展坞.
如果是,监视器应该由xrandr配置它们自己.这是我的脚本:
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/$USER/.Xauthority
sleep 1
DOCKED=$(cat /sys/devices/platform/dock.2/docked)
case "$DOCKED" in
0)
xrandr --output DVI1 --off --output VIRTUAL1 --off --output VGA1 --off &> && xrandr --output LVDS1 --mode 1024x768 --pos 0x0 --rotate normal
;;
1)
xrandr --output VIRTUAL1 --off --output LVDS1 --off && xrandr --output DVI1 --mode 1366x768 --pos 1360x0 --rotate normal --output VGA1 --primary --mode 1360x768 --pos 0x0 --rotate normal
;;
esac
不幸的是xrand在启动时没有以正确的方式工作.它告诉我这个:
xrandr: cannot find mode 1360x768
我有点困惑,因为如果我在我的电脑已经运行时启动脚本它完美无瑕,并且没有错误报告!
所以我猜xrandr在启动时没有找到我的监视器,因此它不知道每个监视器的具体配置.
我该如何解决这个问题?
非常感谢帮助我!