Monday, March 17, 2008

xrandr

In the old days, to get the external VGA output working on my laptop in X, or even switch resolutions, I'd have to edit an overly complex configuration file and restart X. Nowadays, I use the X Resize and Rotate Extension via xrandr, which is considerably more convenient. I like to control displays through the command-line interface. I find typing the full command cumbersome, so I use this simple script instead:
#!/bin/bash
case "$1" in
left)
xrandr --output VGA --auto --left-of LVDS
;;
right)
xrandr --output VGA --auto --right-of LVDS
;;
up)
xrandr --output VGA --auto --above LVDS
;;
down)
xrandr --output VGA --auto --below LVDS
;;
big)
xrandr --output VGA --mode 1600x1200 --above LVDS
;;
off)
xrandr --output VGA --off
;;
*)
xrandr --output VGA --auto --same-as LVDS
;;
esac