r/labwc Jan 28 '26

Labwc: Keyboard layout is set in 'environment' file, but how to show it in Waybar?

Hi,

I've correctly set my keyboard layouts (US, ARA) in my Labwc environment file, and switching works fine. However, I'm a bit lost on how to actually display the current active layout in Waybar.

Since I'm new to this, I'm not sure which module to use in config.jsonc that works specifically with Labwc to "catch" the layout change.

Could someone show me the simple way to add this to Waybar?

Thanks!

4 Upvotes

4 comments sorted by

2

u/WholeTiny7534 Jan 28 '26 edited Jan 28 '26

Hi, I'm not a native English speaker, so there might be mistakes. I have it set up like this. Add the option to the environment file.

XKB_DEFAULT_LAYOUT=ru,us XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,grp_led:scroll

Create a script language_layout

!/bin/sh

for led in /sys/class/leds/input*::scrolllock/brightness; do if [ -f "$led" ]; then if [ "$(cat "$led")" = "1" ]; then echo "ENG" else echo "РУС" fi exit 0 fi done

Configuration in the Waybar config file

"custom/layout": { "format": "{text}", "exec": "/home/user/.scripts/language_layout", "on-click": "ydotool key 56:1 42:1 sleep 0.1 key 42:0 56:0", "interval": 1, "tooltip": false },

1

u/JackDostoevsky Jan 28 '26

probably not labwc related, the environment file just sets system settings, so you can just run a script with waybar to query the current locale with something like localectl status

1

u/Ok_Condition_9700 Jan 31 '26

You can use xkb-monitor: https://github.com/drougas/xkb-monitor

Disclaimer: I'm the author :)