blob: 25f018dddbc09008d138a6008bd9928012ccddf8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/sh
list_layouts()
{
cat <<EOF
us
colemak -option ctrl:swapcaps,altwin:menu_win
EOF
}
current_keymap()
{
setxkbmap -print | awk -F '+' '/xkb_symbols/ {print $2}'
}
NumLayouts="$(list_layouts | wc -l)"
IndexLayout="$(list_layouts | awk "/^$(current_keymap)/ {print NR}")"
[ "$IndexLayout" -eq "$NumLayouts" ] && IndexLayout=1 || IndexLayout=$((IndexLayout + 1))
Layout="$(list_layouts | sed -n "${IndexLayout}p" )"
setxkbmap $Layout &
notify-send -t 1000 "cycleKB" "${Layout%% *}"
|