I want to configure my 2 external screens of my laptop on every startup.
Because I have a kind of dockstation I wrote a small script which retrieves whether my laptop is connected to the dock or not.
If yes the monitors should configure themselfs by xrandr. Here is my script:
#!/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
Unfortunately xrand does not work in the right way on boot. It shows me this:
xrandr: cannot find mode 1360x768
I am a little bit confused because if I start the script while my pc is already running it works flawless and there is no error report!
So I guess xrandr does not find my monitors on startup and therefore it does not know the specific configuration of each of them..
How can I fix this issue??
Thanks a lot for helping me!
Best Answer
First add the mode you want.
Use gtf/cvt and xrandr to do that.