Simple script to change keyboard layout with indication
# capsSwitch | |
# depends on keyboardSwitcher and maclight | |
# to get the list of possible layouts, check `keyboardSwitcher list` output | |
# to check what layouts you use, check `keyboardSwitcher get` while switching layouts | |
layout1="U.S." | |
layout2="Russian - PC" | |
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" | |
# comment this if your gem uses default system paths | |
export RBENV_ROOT="/usr/local/opt/rbenv" | |
export GEM_HOME="/usr/local/opt/gems" | |
export GEM_PATH="/usr/local/opt/gems" | |
# uncomment this if you need to write log | |
#exec 3>&1 4>&2 | |
#trap 'exec 2>&4 1>&3' 0 1 2 3 | |
#exec 1>$HOME/capsSwitch.log 2>&1 | |
currentLayout=`keyboardSwitcher get 2>&1` | |
if [ "$currentLayout" = "$layout1" ]; then | |
keyboardSwitcher "select" "$layout2" && maclight keyboard set -a 1 | |
else | |
keyboardSwitcher "select" "$layout1" && maclight keyboard set -a 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment