mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-26 18:27:13 +08:00
16 lines
597 B
Bash
Executable file
16 lines
597 B
Bash
Executable file
#!/usr/bin/env bash
|
|
notif=/tmp/sway-xkb-layout-notification
|
|
|
|
declare -A layout_pretty_name
|
|
layout_pretty_name["English (US)"]="🍔 Burger"
|
|
layout_pretty_name["Greek"]="🫒 Greek"
|
|
|
|
old_layout_name=-1
|
|
swaymsg -m -t subscribe '["input"]' | while read -r line; do
|
|
layout_name="$(jq -r '.input.xkb_active_layout_name' <<< "$line")"
|
|
if [[ "$layout_name" == "$old_layout_name" || "$layout_name" == "null" ]]; then
|
|
continue
|
|
fi
|
|
old_layout_name="$layout_name"
|
|
notify-send.sh -R "$notif" -u low -t 1000 "Keyboard layout" "${layout_pretty_name[$layout_name]:-$layout_name}"
|
|
done
|