Thursday, April 16, 2009

Swapping ctrl and capslock on debian flavored linux-distros (ie ubuntu)

From the emacs-wiki http://www.emacswiki.org/emacs/MovingTheCtrlKey

1. chmod 644 /etc/default/console-setup then edit that file. Add an X11 style caps lock modification via:

 $ diff -U0 /etc/default/{console-setup.orig,console-setup}
--- /etc/default/console-setup.orig 2009-02-09 03:05:27.000000000 -0500
+++ /etc/default/console-setup 2009-02-09 04:11:20.000000000 -0500
@@ -40 +40 @@
-XKBOPTIONS=""
+XKBOPTIONS="ctrl:swapcaps"

you can do “ctrl:nocaps” instead if you want to two control keys.

2. Trick dpkg into integrating your changes:

 $ sudo dpkg-reconfigure console-setup

and choose all the defaults.

Note that this will only change capslock and ctrl in virtual terminals or when gnome or some other (lesser) window manager is not running.

To swap capslock and ctrl in gnome do:

System->Preferences-> Keyboard Preferences-> Layout tab-> Other Options (aka Layout Options) -> Ctrl key position-> Swap Ctrl and CapsLock radio button.

No comments:

Post a Comment