Switch keyboard layout by clicking the xmobar indicator
Left-click cycles it -> us -> sk(qwerty), right-click cycles backwards, via a new kbd_cycle.sh that calls setxkbmap like the M-i/M-u/M-s keys.
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# Cycle keyboard layout it -> us -> sk(qwerty); "prev" cycles backwards.
|
||||
|
||||
current=$(setxkbmap -query | awk '/^layout:/ {split($2, a, ","); print a[1]}')
|
||||
|
||||
if [[ "$1" == "prev" ]]; then
|
||||
case "$current" in
|
||||
it) next=sk ;;
|
||||
us) next=it ;;
|
||||
*) next=us ;;
|
||||
esac
|
||||
else
|
||||
case "$current" in
|
||||
it) next=us ;;
|
||||
us) next=sk ;;
|
||||
*) next=it ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ "$next" == "sk" ]]; then
|
||||
setxkbmap -layout sk -variant qwerty
|
||||
else
|
||||
setxkbmap -layout "$next" -variant ""
|
||||
fi
|
||||
Reference in New Issue
Block a user