summaryrefslogtreecommitdiff
path: root/.local/sbin/chkb
diff options
context:
space:
mode:
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