1
0
Fork 0

new keymap switcher

This commit is contained in:
Luca Bilke 2022-10-27 09:36:59 +02:00
parent f4dec1797d
commit 54e167a1e3
3 changed files with 25 additions and 6 deletions

View file

@ -1,6 +1,29 @@
#!/bin/sh
setxkbmap -layout us,de -variant dvorak,nodeadkeys -option caps:super -option terminate:ctrl_alt_bksp
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

View file

@ -1,3 +1,3 @@
#/bin/sh
pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
printf "\033[11m\033[10m %s\n" "$(xkb-switch -p)"
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/ /')"

View file

@ -1,4 +0,0 @@
#!/bin/sh
while : ; do
xkb-switch -w && pkill -RTMIN+15 dwmblocks
done