! ! based on: http://www.emacswiki.org/emacs/SwapControlAltAndCapsLock#toc8 ! also based on: http://askubuntu.com/questions/93624/how-do-i-swap-left-ctrl-with-left-alt-on-my-keyboard ! ! Swap Control and Alt keys, both sides: ! First clear all modifiers & control clear control clear mod1 clear mod4 ! Swap Control_L and Alt_L keycode 64 = Control_L keycode 37 = Alt_L Meta_L ! Menu becomes Alt_R Meta_R (AltGr) ! keycode 135 = Alt_R Meta_R ! Define Control_R and Alt_R similar to Control_L and Alt_L keycode 108 = Control_L keycode 105 = Alt_L Meta_L ! We need to set keycodes first, as some programs (emacs!) read ! the key names and seem to ignore what's below. add mod1 = Alt_L Alt_R Meta_L Meta_R add mod4 = Super_L Super_R add control = Control_L Control_R