#!/usr/local/bin/andy set -e NOTIFY_LONG keyboard set -e NOTIFY_SHORT `basename $args[0] set KEYBOARD at-translated-set-2-keyboard set s `{ { hyprctl -j getoption input:kb_layout hyprctl -j getoption input:kb_variant } | jq -rn ' [inputs] | map(.str | split(",\\s*"; "g")) | transpose | map("\(.[0]) (\(.[1]))") | .[] ' | sed -E 's/[a-zA-Z]+/\u&/g' } set choice `echo $s | osel set n `echo $s | sed -n "/$choice/=" | { xargs expr -1 + || true } hyprctl switchxkblayout $KEYBOARD $n >_ notify 'Keyboard Layout Changed' "The keyboard layout was changed to ‘$choice’"