diff options
Diffstat (limited to '.local')
-rwxr-xr-x | .local/share/bin/kbindicator | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/.local/share/bin/kbindicator b/.local/share/bin/kbindicator index 819abb2..ca2acfd 100755 --- a/.local/share/bin/kbindicator +++ b/.local/share/bin/kbindicator @@ -1,9 +1,19 @@ #!/bin/sh -CONTROLLER="`qdbus 'org.fcitx.Fcitx5' '/controller' 'org.fcitx.Fcitx.Controller1.CurrentInputMethod'`" +query_kb_layout() { + CONTROLLER="$(qdbus 'org.fcitx.Fcitx5' '/controller' 'org.fcitx.Fcitx.Controller1.CurrentInputMethod')" + case $CONTROLLER in + "keyboard-us") echo "us" ;; + "keyboard-us-intl") echo "us-intl" ;; + "mozc") echo "jp" ;; + *) ;; + esac +} + +query_kb_layout + +dbus-monitor --address "$(fcitx5-remote -a)" "member='SetCurrentIM',destination='org.fcitx.Fcitx5'" |\ + grep --line-buffered 'SetCurrentIM' |\ + while read -r line ; do + query_kb_layout + done -case $CONTROLLER in - "keyboard-us") echo "us" ;; - "keyboard-us-intl") echo "us-intl" ;; - "mozc") echo "jp" ;; -*) ;; -esac |