vitorpy's Dotfiles
1#!/usr/bin/env bash
2# Requires: jq (or gojq). Use absolute path to avoid PATH issues under Waybar.
3HYPRCTL="/usr/bin/hyprctl"
4JQ="/usr/bin/jq"
5
6# Get the active keymap of the main keyboard
7active="$($HYPRCTL devices -j | $JQ -r '.keyboards[] | select(.main==true) | .active_keymap' | head -n1)"
8
9case "$active" in
10 *Polish*|*Polski*|pl*) echo "PL" ;;
11 *intl*|*English*|*US*) echo "EN" ;; # shows EN for US-Intl
12 *) echo "${active:-?}" ;;
13esac
14