blob: 402a8f5a2a49f885aff6447c09d30444f064350b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/sh
list_layouts()
{
cat <<EOF
us
colemak -option ctrl:swapcaps,altwin:menu_win
EOF
}
ProgramPath="$(readlink -f "$0")"
CurrentKeymap="$(tail -n 1 "$ProgramPath")"
>&2 printf 'Current: %s\n' "$CurrentKeymap"
NumLayouts="$(list_layouts | wc -l)"
[ "$NumLayouts" ] || exit 1
IndexLayout="$(list_layouts | awk "/^${CurrentKeymap}$/ {print NR}")"
[ "$IndexLayout" ] || exit 2
# Cycle
if [ "$IndexLayout" -eq "$NumLayouts" ]; then
IndexLayout=1
else
IndexLayout=$((IndexLayout + 1))
fi
Layout="$(list_layouts | sed -n "${IndexLayout}p" )"
[ "$Layout" ] || exit 3
>&2 printf 'Layout: %s\n' "$Layout"
setxkbmap $Layout &
sed -i "\$s/.*/$Layout/" "$ProgramPath"
notify-send "_cycleKB" "*${Layout%% -*}" &
exit
# THIS LINE IS ADDED AUTOMATICALLY
colemak -option ctrl:swapcaps,altwin:menu_win
|