Skip to content

Instantly share code, notes, and snippets.

@micheller
Last active January 25, 2018 10:54
Show Gist options
  • Save micheller/638f684c0bb38686fac1b2ead9864b89 to your computer and use it in GitHub Desktop.
Save micheller/638f684c0bb38686fac1b2ead9864b89 to your computer and use it in GitHub Desktop.
# swapcaps.sh
#!/bin/sh
if [[ $(xmodmap -pk | grep Caps | awk '{print $1}') = 22 ]]; then
# already configured, do nothing.
exit 0
fi
# remove special key lock and swap caps with backspace
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "keycode 66 = BackSpace"
xmodmap -e "keycode 22 = Caps_Lock"
# swapback.sh
#!/bin/sh
if [[ $(xmodmap -pk | grep Caps | awk '{print $1}') = 66 ]]; then
# already configured, do nothing.
exit 0
fi
# add special key lock and swap caps with backspace
xmodmap -e "keycode 66 = Caps_Lock"
xmodmap -e "keycode 22 = BackSpace"
xmodmap -e "add Lock = Caps_Lock"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment