30 lines
780 B
Bash
Executable File
30 lines
780 B
Bash
Executable File
#!/bin/sh
|
|
|
|
groups="us:dvorak de:nodeadkeys"
|
|
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
|
|
|
index() {
|
|
echo "$groups" | cut -d ' ' -f "$1"
|
|
}
|
|
|
|
i=1
|
|
while [ ! "$found" ]; do
|
|
group=$(index $i)
|
|
if [ "$group" = "$current" ]; then
|
|
newgroup=$(index $((i+1)))
|
|
[ -z "$newgroup" ] && newgroup=$(index 1)
|
|
found=true
|
|
elif [ -z "$group" ]; then
|
|
newgroup=$(index 1)
|
|
found=true
|
|
fi
|
|
i=$((i+1))
|
|
done
|
|
|
|
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
|
xset r rate 300 50
|
|
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
|
sleep 0.03
|
|
pkill -RTMIN+15 dwmblocks
|