diff options
| author | seraphim <18ycm9tx@anonaddy.me> | 2026-08-27 11:50:43 +0700 |
|---|---|---|
| committer | seraphim <18ycm9tx@anonaddy.me> | 2026-08-27 11:50:43 +0700 |
| commit | 6fc7f49449cb237e1aa37eb1025461fe3ea39589 (patch) | |
| tree | ceebc8a65556830627a4546da57e30e72945175e /.config/waybar/kbd-layout.sh | |
| parent | cc7b61a1496d25a100f012300c1121835a9f8177 (diff) | |
.
Diffstat (limited to '.config/waybar/kbd-layout.sh')
| -rwxr-xr-x | .config/waybar/kbd-layout.sh | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/.config/waybar/kbd-layout.sh b/.config/waybar/kbd-layout.sh index e81462a..b1cad08 100755 --- a/.config/waybar/kbd-layout.sh +++ b/.config/waybar/kbd-layout.sh @@ -8,14 +8,13 @@ done STATE="${XDG_RUNTIME_DIR:-/tmp}/waybar-kbd.state" rm -f "$STATE" -# Index of the Russian layout (from configured layouts), so we don't hardcode order. RUS_IDX=$(niri msg keyboard-layouts 2>/dev/null | grep -i russian | grep -oE '^[ *]*[0-9]+' | tr -d ' *' | head -1) kbd_query() { niri msg keyboard-layouts 2>/dev/null | grep -Fm1 '*' | grep -qi russian && echo Ru || echo En } -# Parse a "Keyboard layout switched: N" or "...current_idx: N" event line. +# Parse a "Keyboard layout switched kbd_event() { idx=$(printf '%s' "$1" | grep -oE '[0-9]+' | tail -1) [ "$idx" = "$RUS_IDX" ] && echo Ru || echo En |
