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.
25 lines
527 B
Bash
Executable File
25 lines
527 B
Bash
Executable File
#!/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
|