add layout display to i3blocks

This commit is contained in:
thek4n 2025-11-08 18:39:01 +03:00
parent 89b210f663
commit 1471013bd7
2 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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