After a while running xrandr after each login to get my external monitor configured, I finally sat down and made a script for doing it automatically.

The only point was that the monitor is not always plugged on my laptop, so a trivial check must be done in advance.

The following script is called before dwm at $HOME/.xinitrc:

#!/bin/sh
 
VGA=`xrandr 2>&1| grep "VGA1 connected"`
 
if [ -n "$VGA" ] ; then
    /usr/bin/xrandr --output LVDS1 --mode 1024x768 --pos 0x0 --rotate normal --output VGA1 --mode 1440x900 --pos 1024x0 --rotate normal
fi

It's quite self-explanatory I think :)

Tagged as xrandr, vga

If you liked this post, you can donate using Bitcoin 12jVrWkk5S6x5hEizThZwgTx59KxaDdK4C