summaryrefslogtreecommitdiff
path: root/ar/.local/bin
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-02-02 04:26:37 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-02-02 04:26:37 +0900
commita16c04bf2c5df1f145c3552aea8581bd8e8319cf (patch)
tree12e37c395497a84cf2af2b6cd8c655d1195a9f3c /ar/.local/bin
parentf31821429df4bdc7171a6d7f37ae48d802868a5d (diff)
updates
Diffstat (limited to 'ar/.local/bin')
-rwxr-xr-xar/.local/bin/statusbar/sb-keyboard29
1 files changed, 13 insertions, 16 deletions
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"