From 1471013bd7375dd1f3ff2ff827be740bef927a5e Mon Sep 17 00:00:00 2001 From: thek4n Date: Sat, 8 Nov 2025 18:39:01 +0300 Subject: [PATCH] add layout display to i3blocks --- home/user/.config/i3blocks/config | 4 ++++ home/user/.local/bin/i3blocks_helper | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/home/user/.config/i3blocks/config b/home/user/.config/i3blocks/config index 2ef30b7..b939672 100644 --- a/home/user/.config/i3blocks/config +++ b/home/user/.config/i3blocks/config @@ -51,6 +51,10 @@ command=i3blocks_helper pomodoro interval=1 signal=10 +[language] +command=i3blocks_helper language +interval=1 + [time] command=i3blocks_helper time interval=30 diff --git a/home/user/.local/bin/i3blocks_helper b/home/user/.local/bin/i3blocks_helper index 5c0ee58..1662dd1 100755 --- a/home/user/.local/bin/i3blocks_helper +++ b/home/user/.local/bin/i3blocks_helper @@ -76,6 +76,22 @@ cmd_bluetooth_battery() { done } +cmd_language() { + layout="$(xkblayout-state print %n)" + + case "${layout}" in + English) + echo "🇬🇧 En" + ;; + Russian) + echo "🇷🇺 Ru" + ;; + *) + echo "🌐 ${layout}" + ;; + esac +} + case "${1}" in wireless) shift; cmd_wireless "$@" ;; ethernet) shift; cmd_ethernet "$@" ;; @@ -89,6 +105,7 @@ case "${1}" in volume) shift; cmd_volume "$@" ;; pomodoro) shift; cmd_pomodoro "$@" ;; bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;; + language) shift; cmd_language "$@" ;; *) exit "${EXIT_FAILURE}" ;; esac