Skip to content

Instantly share code, notes, and snippets.

@tamphh tamphh/input_source
Created Jul 4, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.