Skip to content

Instantly share code, notes, and snippets.

@berkes
Created October 4, 2015 09:57
Show Gist options
  • Save berkes/05edefafa84c8c5f053e to your computer and use it in GitHub Desktop.
Save berkes/05edefafa84c8c5f053e to your computer and use it in GitHub Desktop.
#!/bin/bash
current=$(dconf read /org/gnome/desktop/input-sources/xkb-options)
swapped="['caps:swapescape']"
capslock="['caps:capslock']"
echo "Current status: $current"
if [ "$current" == "$swapped" ]
then
echo "Making caps and escape WORK NORMALLY"
dconf write /org/gnome/desktop/input-sources/xkb-options $capslock
elif [ "$current" == "$capslock" ]
then
echo "Swapping caps and escape"
dconf write /org/gnome/desktop/input-sources/xkb-options $swapped
else
echo "caps is not swapescaped nor capslock. Doing nothing."
fi
@berkes
Copy link
Author

berkes commented Oct 4, 2015

I have swapped my escape and caps, to aid my Vim-Fu. After all: no-one needs CAPSLOCK anyway.

But this confuses co-workers who sit at my computer. This tiny script allows me to quickly toggle the behaviour of Capslock and escape between "normal" and "swapped".

Oh. This is Ubuntu/Gnome stuff. I doubt it even works on KDE and certainly not on Windows or OSX.

@e0da
Copy link

e0da commented Feb 18, 2017

Gnice. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment