diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 07:36:05 +0300 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 07:36:05 +0300 |
commit | c7e31e10bb6c0e1cc4547c472708aa1e1bee4b66 (patch) | |
tree | 32c137daaf39986423f0b8c4d711a2ca0f27dc98 /.local/bin | |
parent | 43a5172f1877b3426d121d1fd8724be6734580a1 (diff) |
chkb: Add ‘chkb’ to change keyboards
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/chkb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/.local/bin/chkb b/.local/bin/chkb new file mode 100755 index 0000000..bc6da23 --- /dev/null +++ b/.local/bin/chkb @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +export OSEL_GUI='wofi -d -r "echo \"%s\" | cut -f2 | xargs echo -n"' + +choice="`sed -En 's/\s*name\[Group1\]\s*=\s*"([^"]*)"\s*;\s*/\1/p' \ + ~/.xkb/symbols/mango \ + | sort \ + | nl -v0 -nln \ + | osel`" + +[ -n "$choice" ] && { + hyprctl -j devices \ + | jq -r '.keyboards[-1].name' \ + | xargs -I{} hyprctl switchxkblayout {} ${choice% *} + notify-send -a "${0##*/}" -u normal 'Keyboard Layout Changed' \ + "The keyboard layout was changed to ‘${choice##* }’" +} |