summaryrefslogtreecommitdiff
path: root/.local/bin/chkb
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-06 01:30:57 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-06 01:30:57 +0100
commit02e4686ccd7c95c6df855be61496c75c92b11396 (patch)
tree10ef22afb440b6f91e695d25677f130a5a79f75f /.local/bin/chkb
parentd9f33332f52a60130325a5d16785ee9577647d42 (diff)
scripts: Move many scripts from sh to andy
Diffstat (limited to '.local/bin/chkb')
-rwxr-xr-x.local/bin/chkb26
1 files changed, 13 insertions, 13 deletions
diff --git a/.local/bin/chkb b/.local/bin/chkb
index d38aaa8..359f443 100755
--- a/.local/bin/chkb
+++ b/.local/bin/chkb
@@ -1,26 +1,26 @@
-#!/bin/sh
+#!/usr/local/bin/andy
-set -e
+set -e NOTIFY_LONG keyboard
+set -e NOTIFY_SHORT chkb
-export NOTIFY_LONG=keyboard
-export NOTIFY_SHORT=${0##*/}
+set KEYBOARD at-translated-set-2-keyboard
-readonly KEYBOARD=at-translated-set-2-keyboard
-
-s="$(
+set s `{
{
hyprctl -j getoption input:kb_layout
hyprctl -j getoption input:kb_variant
- } | jq -rn '
+ }
+ | jq -rn '
[inputs]
| map(.str | split(",\\s*"; "g"))
| transpose
| map("\(.[0]) (\(.[1]))")
| .[]
- ' | sed -E 's/[a-zA-Z]+/\u&/g'
-)"
+ '
+ | sed -E 's/[a-zA-Z]+/\u&/g'
+}
-choice="$(echo "$s" | osel)"
-n="$(echo "$s" | sed -n "/$choice/=" | { xargs expr -1 + || true; })"
-hyprctl switchxkblayout $KEYBOARD $n >/dev/null
+set choice `echo $s | osel
+set n `echo $s | sed -n "/$choice/=" | { xargs expr -1 + || true }
+hyprctl switchxkblayout $KEYBOARD $n >_
notify 'Keyboard Layout Changed' "The keyboard layout was changed to ‘$choice’"