summaryrefslogtreecommitdiff
path: root/.local/sbin/chkb
blob: 36398e3d2b8dd6f23cc52b8874ed790d83187b64 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

export NOTIFY_LONG=keyboard
export NOTIFY_SHORT="$(basename "$0")"

readonly LAYOUTS="$(niri msg -j keyboard-layouts)"
sel="$(echo "$LAYOUTS" | jq -r '.names.[]' | osel -i)"
if [ -n "$sel" ]
then
	niri msg action switch-layout "$sel"
	choice="$(echo "$LAYOUTS" | jq -r ".names.[$sel]")"
	notify 'Keyboard Layout Changed' \
		"The keyboard layout was changed to ‘$choice’"
fi