diff options
author | Raymaekers Luca <luca@spacehb.net> | 2025-01-05 19:49:12 +0100 |
---|---|---|
committer | Raymaekers Luca <luca@spacehb.net> | 2025-01-05 19:49:12 +0100 |
commit | a7309ce61c093caeb554c20497f4e4b765073203 (patch) | |
tree | 6e7c9e559253f0f0584175c582624eec29a0d5cb /bin/extra/cycleKB | |
parent | 58bf86c706c5a442da4fb01ea26e06f1ed291d45 (diff) | |
parent | 112449dd19eaae6769ef95a70b3e52234256400c (diff) |
checkpoint
Diffstat (limited to 'bin/extra/cycleKB')
-rwxr-xr-x | bin/extra/cycleKB | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB index 154f5a1..597f26f 100755 --- a/bin/extra/cycleKB +++ b/bin/extra/cycleKB @@ -1,6 +1,21 @@ #!/usr/bin/sh -keyboards="$HOME/bin/keyboards.txt" -kb="$(head -n 1 "$keyboards")" -setxkbmap $kb & -sed -i '1h;1d;$G' "$keyboards" -notify-send -t 1000 "cycleKB" "${kb%% *}" + +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 & +herbe "_cycleKB" "*${Layout%% *}" |