Skip to content

Instantly share code, notes, and snippets.

@vkargov
Last active May 18, 2016 05:21
Show Gist options
  • Save vkargov/6ff7b06de6be53cbe0540497226877fe to your computer and use it in GitHub Desktop.
Save vkargov/6ff7b06de6be53cbe0540497226877fe to your computer and use it in GitHub Desktop.
My Linux keyboard layout...
#!/bin/sh
# My crazy layout...
# command <=> alt
# control <=> capslock
# enter becomes "control" when not released instantly
# Should be as close to my osx/karabiner config as possible...
# Because XFCE is not cool, it resets the settings when calling xkbmap.
# So putting this into .xinitrc won't cut it.
# A possible solution would be renaming it into something like .xinitrc_, and then
# going into "session and startup" in the settings and making an startup entry
# like "bash (your_home)/.xinitrc_
xmodmap - <<EOF
!
! Swap Caps_Lock and Control_L
!
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Caps_Lock
add Control = Control_L
! Swap Enter and Control_R
!remove Lock = Caps_Lock
!remove Control = Control_R
!keysym Control_L = Caps_Lock
!keysym Caps_Lock = Control_R
!add Lock = Caps_Lock
!add Control = Control_L
! Swap alt and capslock
remove Lock = Caps_Lock
! Swap Alt and Super, reassign the Mod1 and Mod4 groups associated with them
!(some apps follow the key names, some group names...)
keycode 64 = Super_L
keycode 133 = Meta_L Alt_L
keycode 108 = Super_R
keycode 134 = Meta_L Alt_R
clear Mod1
add Mod1 = Alt_L Alt_R Meta_L
! xfce resets it when it starts...
! Perhaps Mod4 is not useful at all?
clear Mod4
add Mod4 = Super_L Super_R Hyper_L
! Prepare Enter for being xcape-d
! Taken from http://emacsredux.com/blog/2013/11/12/a-crazy-productivity-boost-remap-return-to-control/#comment-2390333177
remove Control = Control_R
keycode 0x24 = Control_R
keycode 0x69 = Return
add Control = Control_R
EOF
xcape -e 'Control_R=Return'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment