Bash script to get input source (keyboard name) fo OS X
#!/bin/bash | |
input_name=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources | egrep -w 'KeyboardLayout Name' | sed -E 's/^.+ = \"?([^\"]+)\"?;$/\1/') | |
if [[ -z "$input_name" ]]; then | |
echo "V.N" | |
elif [[ -n "$input_name" ]]; then | |
echo "U.S" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment