From 0467fa38e57589f2bcd5cfeca5643f360800460e Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Fri, 10 Jan 2025 09:53:47 +0100 Subject: checkpoint --- bin/extra/cycleKB | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'bin/extra/cycleKB') diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB index 597f26f..8f0de60 100755 --- a/bin/extra/cycleKB +++ b/bin/extra/cycleKB @@ -4,18 +4,35 @@ list_layouts() { cat <&2 printf 'Current: %s\n' "$CurrentKeymap" NumLayouts="$(list_layouts | wc -l)" -IndexLayout="$(list_layouts | awk "/^$(current_keymap)/ {print NR}")" -[ "$IndexLayout" -eq "$NumLayouts" ] && IndexLayout=1 || IndexLayout=$((IndexLayout + 1)) +[ "$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 & -herbe "_cycleKB" "*${Layout%% *}" +sed -i "\$s/.*/$Layout/" "$ProgramPath" +notify-send "_cycleKB" "*${Layout%% -option*}" & + +exit + +# THIS LINE IS ADDED AUTOMATICALLY +us -variant colemak -option ctrl:swapcaps,altwin:menu_win -- cgit v1.2.3