i3status-rust
i3status-rust copied to clipboard
Keyboard layout not updated when starting kbdd from .xinitrc
Hi,
I am using i3wm on Arch Linux and have been enjoying i3status-rust for a couple of years now. After I had switched the driver in keyboard_layout
block to kbddbus
, it had really been a convenient experience for me.
But in the latest update (i3status-rs 0.30.5), for some reason, the keyboard layout shown in the status bar is not updated when I switch to other layouts; it is stuck in the default layout (EN). Note that I can still switch to other layouts just fine, but the layout shown in the status bar just won't be updated.
My current workaround is to remove kbdd
from .xinitrc
, then start it manually in a terminal after startx
. For some reason, if I start kbdd
manually after startx
, the keyboard layout in the status bar is updated just fine when I switch the layouts.
Here's my keyboard_layout
block settings:
[[block]]
block = "keyboard_layout"
driver = "kbddbus"
[block.mappings]
"English (US)" = "EN"
"German (N/A)" = "DE"
"Thai (N/A)" = "TH"
I have double checked that the kbdd
process is present in all cases.
Hope I'm not alone here and appreciate every help.
So the last version it was working for you was v0.22?
Very sorry for my late reply, I have been using the workaround I mentioned above all this time. I was searching for the previous version that worked for me and I forgot to answer.
So the previous version that worked for me was 0.30.3.
So the previous version that worked for me was 0.30.3.
Weird, because src/blocks/keyboard_layout.rs
hasn't been changed between 0.30.0 and 0.30.6...
Let me try debugging this then. It'll be my first time working on Rust XD
I want to update with the information on how I set up my multiple keyboard layouts. I use a configuration file 00-keyboard.conf
in /etc/X11/xorg.conf.d/
with the content:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us,de,th"
Option "XkbModel" "pc105"
Option "XkbVariant" ",,"
Option "XkbOptions" "grp:win_space_toggle"
EndSection
Note that this configuration works; I can switch between layouts. But i3status-rs just doesn't update the layout shown in the JSON/bar.
I had a similar problem, but tafter some digging I found he problem lies in kbdd itself, for example when I run
dbus-monitor interface=ru.gentoo.kbdd
I see that when I change layouts only for the primary one I receive layoutNameChanged event, for the secondary only layoutChanged is received, but this one contains only a number and is not a good default match for i3status-rs.
I'm not sure there is much we can do here, probably what we can do is monitor layoutChanged, which will result in 0, 1, 2 shown in the UI (with formatting these can easily be changed to whatever you like). The initial implementation was actually using these indexes to fetch the layout from setxkbmap -query
(layout: ...) which worked OKish, but after migration to async, zbus, and with the new options for formatting I decided to use the layoutNameChanged parameter. I can easily change this back, but this will require having setxkbmap installed on the system, which I don't think is always the case these days.
The proper solution is to find out why kbdd is not getting the right name, but this is out of my abilities.
I'll happily investigate any other ideas.
btw my solution was to change the following:
exec_always setxkbmap -option; setxkbmap -option grp:toggle,grp:shifts_toggle,grp_led:scroll,ctrl:nocaps us,bg -variant ,bas_phonetic
exec_always --no-startup-id pkill kbdd; /usr/bin/kbdd
to
exec_always setxkbmap -option; setxkbmap -option grp:toggle,grp:shifts_toggle,grp_led:scroll,ctrl:nocaps us,bg -variant ,bas_phonetic; pkill kbdd; /usr/bin/kbdd
This was sufficient for me...