From 5fb19f10389b70ee2389755106092a9ef6c64598 Mon Sep 17 00:00:00 2001 From: David Moc Date: Sun, 24 May 2026 11:48:07 +0200 Subject: Go --- polybar/scripts/kb-status.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 polybar/scripts/kb-status.sh (limited to 'polybar/scripts/kb-status.sh') diff --git a/polybar/scripts/kb-status.sh b/polybar/scripts/kb-status.sh new file mode 100755 index 0000000..551e587 --- /dev/null +++ b/polybar/scripts/kb-status.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +export DISPLAY="${DISPLAY:-:0}" +if [ -z "${XAUTHORITY:-}" ] && [ -r "$HOME/.Xauthority" ]; then + export XAUTHORITY="$HOME/.Xauthority" +fi + +query="$(setxkbmap -query 2>/dev/null || true)" +layout="$(printf '%s\n' "$query" | awk '/^layout:/ { print $2; exit }')" +variant="$(printf '%s\n' "$query" | awk '/^variant:/ { print $2; exit }')" + +case "${layout:-unknown}:${variant:-}" in + us:dvorak) + echo "us dv" + ;; + cz:*|cz:) + echo "cz" + ;; + *:) + echo "${layout:-unknown}" + ;; + *) + echo "${layout:-unknown} ${variant}" + ;; +esac -- cgit v1.2.3