Screen toggle script using xrandr

Many of my friends using Linux have serious problems with switching screens, screen resolutions, connecting to projectors, etc. and all of them end up wasting humongous amount of time doing stuff like that. And after banging their heads for 30 minutes they curse Linux and all and put up a request for another meeting! Anyways, below is the code to get screen toggling and switching screens easily done. Of course one needs to modify to suite their own use-cases but I guess the script itself will suffice most people.

Also be sure to use the open source drivers for your graphic card and not the proprietary ones. Probably it does not work with proprietary drivers but if it does, do give me a heads up in the comments.
# Created by Naresh Mehta (c) 2012 - www.naresh.se
#!/bin/sh
## echo $1 " is a parameter -- Naresh"
case $1 in
    -dd|--dockdual)
	xrandr --output LVDS --off
	xrandr --output VGA-0 --mode 1680x1050 --primary
	xrandr --output DVI-0 --mode 1680x1050 --right-of VGA-0
	;;
    -d|--dock)
##	xrandr --output DVI-0 --mode 1680x1050 --primary \
	xrandr --output LVDS --off
	xrandr --output VGA-0 --mode 1680x1050 --primary
##	xrandr --output DVI-0 --mode 1680x1050 --right-of VGA-0
##--right-of DVI-0
	;;
    -u|--undock|-l|--laptop)
	xrandr --output VGA-0 --off --output DVI-0 --off
	xrandr --output LVDS --mode 1280x800 --primary
	;;
    -p|--projector)
	xrandr --output LVDS --mode 1280x800 --primary
	xrandr --output VGA-0 --mode 1680x1050 --right-of LVDS
	;;
    -c|--clone)
	xrandr --output LVDS --mode 1280x800 --primary
	xrandr --output VGA-0 --mode 1280x800 --primary
	;;
    -h|--help|*)
	echo ""
	echo "Script Usage: toggle_dock.sh [OPTION]"
	echo ""
	echo " -d, --dock 	When the docking station is used"
	echo " -u, --undock	When the laptop is removed from the docking station"
	echo " -p, --projector	When connecting to a projector (VGA0)"
	echo " -c, --clone      When cloning laptop screen on projector"
	echo " -l, --laptop 	Getting back the dislpay on laptop LCD"
	echo " -h, --help	Show this help screen"
	echo ""
	;;
esac
Oh and put it in a bash script, make it executable and run it with the proper option. ENJOY