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