summaryrefslogtreecommitdiff
path: root/mac/.config/sketchybar.allapp/plugins/get_input_source.sh
blob: 89dab2ba7e3b133598b6beb77ef051a540997b13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# hangul and english item

# Read the plist data
plist_data=$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources)
current_input_source=$(echo "$plist_data" | plutil -convert xml1 -o - - | grep -A1 'KeyboardLayout Name' | tail -n1 | cut -d '>' -f2 | cut -d '<' -f1)

if [ "$current_input_source" = "ABC" ]; then
    sketchybar --set input_source icon="􀂕"
else
    sketchybar --set input_source icon="􀂩"
fi