#!/bin/bash PORT=$2 [ -z "$PORT" ] && PORT=VGA1 [ -z "$1" ] && echo "usage: $0 []" && exit 1 on() { xrandr --output $PORT --auto xmodmap ~/dot/Xmodmap.ctrl } off() { xrandr --output $PORT --off xrandr --output LVDS1 --auto } $1 # This will also configure USB keyboard. xmodmap ~/dot/Xmodmap.ctrl