Created
July 4, 2019 07:31
-
-
Save tamphh/f68a574588b810349ee6bcdf9e970141 to your computer and use it in GitHub Desktop.
Bash script to get input source (keyboard name) fo OS X
This file contains hidden or 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 | |
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