Skip to content

Instantly share code, notes, and snippets.



Created Jul 4, 2019
What would you like to do?
Bash script to get input source (keyboard name) fo OS X
input_name=$(defaults read ~/Library/Preferences/ 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment