Created
November 4, 2014 05:25
-
-
Save shi-yan/6b1cf048832490ea3160 to your computer and use it in GitHub Desktop.
Swap the Ctrl and the Windows key under ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm so used to Mac key mapping that I want to use the windows key as the ctrl, and the ctrl as the windows key. | |
I found a very useful link here: | |
http://stackoverflow.com/questions/21845209/remap-ctrl-alt-super-keys-in-ubuntu-13-10 | |
first run this to generate the keymap | |
xmodmap -pke > ~/.Xmodmap. | |
open .Xmodmap file, add these at the beginning: | |
clear control | |
clear mod1 | |
clear mod4 | |
and these at the end: | |
add control = Control_L Control_R | |
add mod1 = Alt_L Alt_R | |
add mod4 = Super_L Super_R | |
swap the key codes for ctrl and windows. | |
save the file and run: | |
xmodmap ~/.Xmodmap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Swap control and alt
!
! based on: http://www.emacswiki.org/emacs/SwapControlAltAndCapsLock#toc8
!
!----------------------------------------------------------
! 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
!------------------------------------------
! Caps_Lock becomes an additional BackSpace
!------------------------------------------
remove lock = Caps_Lock
keysym Caps_Lock = BackSpace