aboutsummaryrefslogtreecommitdiff
path: root/.local/share/bin/kbindicator
blob: ca2acfd68caf637a6af315020b9c2e51ad13a981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
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