summaryrefslogtreecommitdiff
path: root/.local/bin/chkb
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-25 01:09:10 +0300
committerThomas Voss <mail@thomasvoss.com> 2023-08-25 01:09:10 +0300
commit4817c1bc0222f7172d1acb9c18912a7e6f36a3c7 (patch)
tree866b26eb026059150f3cfbcbe3626b9cd09bdd36 /.local/bin/chkb
parenta6afe32f76cfaaaf52befba24c5634e1f3ed1912 (diff)
bin/sbin: Refactor shell scripts
Diffstat (limited to '.local/bin/chkb')
-rwxr-xr-x.local/bin/chkb23
1 files changed, 12 insertions, 11 deletions
diff --git a/.local/bin/chkb b/.local/bin/chkb
index bc6da23..4f96877 100755
--- a/.local/bin/chkb
+++ b/.local/bin/chkb
@@ -2,18 +2,19 @@
set -e
-export OSEL_GUI='wofi -d -r "echo \"%s\" | cut -f2 | xargs echo -n"'
+export OSEL_GUI_FLAGS='-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" ] && {
+if choice="`
+ sed -En 's/\s*name\[Group1\]\s*=\s*"([^"]*)"\s*;\s*/\1/p' \
+ ~/.xkb/symbols/mango \
+ | sort \
+ | nl -v0 -nln \
+ | osel
+`"
+then
hyprctl -j devices \
| jq -r '.keyboards[-1].name' \
- | xargs -I{} hyprctl switchxkblayout {} ${choice% *}
+ | xargs -I{} hyprctl switchxkblayout {} ${choice% *} >/dev/null
notify-send -a "${0##*/}" -u normal 'Keyboard Layout Changed' \
- "The keyboard layout was changed to ‘${choice##* }’"
-}
+ "The keyboard layout was changed to ‘${choice##* }’."
+fi