2019-05-04 02:34:41 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo $$ > /tmp/gnome-kb-layout-watcher.pid
|
|
|
|
|
|
|
|
MAIN_KB_LAYOUT=$(gsettings get org.gnome.desktop.input-sources sources | sed -e 's!\[!!g; s!\]!!g; s!), (!,!g; s!(!!; s!)!!g; s! !!g;' | awk -F, '{print $2}' | sed "s/'//g")
|
|
|
|
|
2019-05-05 16:53:13 +03:00
|
|
|
LAST_KB_LAYOUT=''
|
|
|
|
|
2019-05-04 02:34:41 +03:00
|
|
|
while :
|
|
|
|
do
|
|
|
|
CURRENT_KB_LAYOUT=$(gsettings get org.gnome.desktop.input-sources mru-sources | sed -e 's!\[!!g; s!\]!!g; s!), (!,!g; s!(!!; s!)!!g; s! !!g;' | awk -F, '{print $2}' | sed "s/'//g")
|
|
|
|
|
2019-05-05 16:53:13 +03:00
|
|
|
if ! [[ "$LAST_KB_LAYOUT" == "$CURRENT_KB_LAYOUT" ]]; then
|
|
|
|
if [[ "$CURRENT_KB_LAYOUT" == "$MAIN_KB_LAYOUT" ]]; then
|
|
|
|
echo "1" > /tmp/kb-layout
|
|
|
|
else
|
|
|
|
echo "0" > /tmp/kb-layout
|
|
|
|
fi
|
|
|
|
LAST_KB_LAYOUT="$CURRENT_KB_LAYOUT"
|
2019-05-04 02:34:41 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
sleep .1
|
|
|
|
done
|