From 4e3c4e64707b4775f4bc59f27c2bbff4ad61e1e6 Mon Sep 17 00:00:00 2001 From: pyrschtjag Date: Fri, 30 Oct 2026 11:00:28 +0400 Subject: [PATCH] feat(waybar): add custom language layout indicator script --- waybar/scripts/lang.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 waybar/scripts/lang.sh diff --git a/waybar/scripts/lang.sh b/waybar/scripts/lang.sh new file mode 100755 index 0000000..8f2d18b --- /dev/null +++ b/waybar/scripts/lang.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +print_layout() { + swaymsg -t get_inputs | jq -r ' + [.[] | select(.type=="keyboard" and .xkb_active_layout_name != null)] + | first | .xkb_active_layout_name + | if test("Russian") then "RU" + elif test("English") then "EN" + else .[0:2] end' +} +while true; do + print_layout + swaymsg -t subscribe -m '["input"]' | while read -r _; do + print_layout + done + sleep 1 +done