From c7e31e10bb6c0e1cc4547c472708aa1e1bee4b66 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 23 Aug 2023 07:36:05 +0300 Subject: chkb: Add ‘chkb’ to change keyboards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .local/bin/chkb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .local/bin/chkb diff --git a/.local/bin/chkb b/.local/bin/chkb new file mode 100755 index 0000000..bc6da23 --- /dev/null +++ b/.local/bin/chkb @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +export OSEL_GUI='wofi -d -r "echo \"%s\" | cut -f2 | xargs echo -n"' + +choice="`sed -En 's/\s*name\[Group1\]\s*=\s*"([^"]*)"\s*;\s*/\1/p' \ + ~/.xkb/symbols/mango \ + | sort \ + | nl -v0 -nln \ + | osel`" + +[ -n "$choice" ] && { + hyprctl -j devices \ + | jq -r '.keyboards[-1].name' \ + | xargs -I{} hyprctl switchxkblayout {} ${choice% *} + notify-send -a "${0##*/}" -u normal 'Keyboard Layout Changed' \ + "The keyboard layout was changed to ‘${choice##* }’" +} -- cgit v1.2.3