greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.82k stars 472 forks source link

Keyboard block doesn't catch layout changes #1395

Open cfsmp3 opened 2 years ago

cfsmp3 commented 2 years ago

For me, at least.

dbus-monitor shows this event for me - totally different info:

signal time=1642201033.914655 sender=:1.85 -> destination=(null destination) serial=1073 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.impl.portal.Settings; member=SettingChanged
   string "org.gnome.desktop.input-sources"
   string "mru-sources"
   variant       array [
         struct {
            string "xkb"
            string "es"
         }
         struct {
            string "xkb"
            string "us"
         }
      ]
signal time=1642201033.914770 sender=:1.84 -> destination=(null destination) serial=4586 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Settings; member=SettingChanged
   string "org.gnome.desktop.input-sources"
   string "mru-sources"
   variant       array [
         struct {
            string "xkb"
            string "es"
         }
         struct {
            string "xkb"
            string "us"
         }
      ]
MaxVerevkin commented 2 years ago

Do you use sway or i3? Which driver have you set in your config? How do you change your layout?

cfsmp3 commented 2 years ago

Do you use sway or i3? Which driver have you set in your config? How do you change your layout?

i3

I haven't tried the other two as polling here is out of the question :-)

I change the layout by pressing Super + Alt + Backspace , I haven't looked into what that triggers (I was just casually looking into this block)

MaxVerevkin commented 2 years ago

kbddbus doesn't work ("is kbdddaemon bus running?")

So, do you run https://github.com/qnikst/kbdd?

cfsmp3 commented 2 years ago

kbddbus doesn't work ("is kbdddaemon bus running?")

So, do you run https://github.com/qnikst/kbdd?

No, I don't need to have per-window setting. I was just mentioning that I tried the driver, I didn't expect it to work :-)

BTW I tried

setxkbmap us

And it doesn't seem to trigger any D-Bus notification (I might be filtering wrong).

MaxVerevkin commented 2 years ago

AFAIK there is no standard way to monitor kbd layout on X11.

I imagine you can create a script that somehow toggles the layout and sends a signal to i3status-rs to update. In this case you can use setxkbmap driver with a large interval.

However signal support for keyboard_layout is not implemented yet. It shouldn't be hard to implement signal option support generically for all the blocks (analogous to on_click). (You can send SIGUSR1 but it will update every block.)

MaxVerevkin commented 2 years ago

It shouldn't be hard to implement signal option support generically for all the blocks

Well, that was a lie :) Anyway, implemented in https://github.com/greshake/i3status-rust/commit/f0431aea84b465c98f3b14caa1f4a85fa88eb316.