From a16c04bf2c5df1f145c3552aea8581bd8e8319cf Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sun, 2 Feb 2025 04:26:37 +0900 Subject: updates --- ar/.local/bin/statusbar/sb-keyboard | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'ar/.local') diff --git a/ar/.local/bin/statusbar/sb-keyboard b/ar/.local/bin/statusbar/sb-keyboard index 6329020..bb4c780 100755 --- a/ar/.local/bin/statusbar/sb-keyboard +++ b/ar/.local/bin/statusbar/sb-keyboard @@ -2,8 +2,6 @@ # works on any init system # requirements: dmenu, xorg-setxkbmap -kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 - case $BLOCK_BUTTON in 1) fcitx5-remote -t && kill -44 "$(pidof "${STATUSBAR:-dwmblocks}")" ;; 2) @@ -19,17 +17,16 @@ case $BLOCK_BUTTON in 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac -if [ "$kb" = "us" ] || [ "$kb" = "kr" ]; then - if [ "$(fcitx5-remote)" -eq 1 ]; then - echo "⌨️US" - elif [ "$(fcitx5-remote)" -eq 2 ]; then - case "$(fcitx5-remote -n)" in - *ko* | *Korean* | *hangul*) echo "⌨️KO" ;; - *) echo "⌨️$(setxkbmap -query | grep 'layout:' | sed 's/layout:\s*\(\S*\)/\1/g')" ;; - esac - else - echo "⌨️??" - fi -else - echo "⌨️$kb" -fi +method=$(dbus-send --print-reply --dest=org.fcitx.Fcitx5 \ + /controller org.fcitx.Fcitx.Controller1.CurrentInputMethod | + awk -F '"' '/string/ {print $2}') + +case "$method" in +keyboard-us) + icon="⌨️US" + ;; +hangul) + icon="⌨️KO" + ;; +esac +echo "$icon" -- cgit v1.2.3