Monitors are automatically reconfigured when machine is docked/undocked. Some specifics of this implementation depend on the use of fglrx (the ATI proprietary driver) but that would be easily factored out.
Making the caps-lock key act as a control key
There’s a bug that prevents the straightforward approach using gnome-keyboard-properties from working, at least on its own.
install /etc/boottime.kmap.gz and do an update-initramfs. This handles consoles
In gnome-keyboard-properties, “Layouts > Other Options > Ctrl Key Position > Make CapsLock and additional Ctrl.” This may be better handled in xorg.conf if we want it to work that way across all accounts.
install /etc/udev/rules.d/85-capslock.rules, /usr/local/sbin/capslock, /usr/local/share/acpi-support/power-funcs. This handles external keyboards