Created
June 21, 2016 00:10
-
-
Save w-shackleton/75f1cbf0134008695921e2ca0ccfc216 to your computer and use it in GitHub Desktop.
Scripts to enable and disable swapping caps lock and escape on Linux, and to disable during a program's execution.
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
#!/bin/bash | |
if [[ $# == 0 ]] | |
then | |
echo "Usage: $0 [normal|swapped]" | |
fi | |
case "$1" in | |
normal) gsettings set org.gnome.desktop.input-sources xkb-options "[]" ;; | |
swapped) gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']" ;; | |
*) | |
echo "Invalid argument" | |
exit 1 | |
esac |
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
#!/bin/bash | |
# Use this script as: | |
# ./wrap.sh <command> <arg1...> | |
# To swap caps lock and escape back during the execution of the given command. | |
# This is useful when eg. running a game in Steam; set the launch options as | |
# /path/to/.../wrap.sh %command% | |
# to disable swapping during the game. | |
gsettings set org.gnome.desktop.input-sources xkb-options "[]" | |
$@ | |
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment