#!/usr/bin/sh list_layouts() { cat <&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%% -option*}" & exit # THIS LINE IS ADDED AUTOMATICALLY us -variant colemak -option ctrl:swapcaps,altwin:menu_win