summaryrefslogtreecommitdiff
path: root/.local/sbin/chkb
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2026-02-27 20:56:50 +0100
committerThomas Voss <mail@thomasvoss.com> 2026-02-27 20:56:50 +0100
commitffbea28e2f16161ad4f62078e5b20269243a7052 (patch)
treeb2492538f07810de56c8dbcbf65c36ed5d708a74 /.local/sbin/chkb
parentcfae1e6bd13f30b1296a26d83445f25bcc4136e0 (diff)
chkb: Rewrite script to support Niri
Diffstat (limited to '.local/sbin/chkb')
-rwxr-xr-x.local/sbin/chkb14
1 files changed, 14 insertions, 0 deletions
diff --git a/.local/sbin/chkb b/.local/sbin/chkb
new file mode 100755
index 0000000..36398e3
--- /dev/null
+++ b/.local/sbin/chkb
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+export NOTIFY_LONG=keyboard
+export NOTIFY_SHORT="$(basename "$0")"
+
+readonly LAYOUTS="$(niri msg -j keyboard-layouts)"
+sel="$(echo "$LAYOUTS" | jq -r '.names.[]' | osel -i)"
+if [ -n "$sel" ]
+then
+ niri msg action switch-layout "$sel"
+ choice="$(echo "$LAYOUTS" | jq -r ".names.[$sel]")"
+ notify 'Keyboard Layout Changed' \
+ "The keyboard layout was changed to ‘$choice’"
+fi