sneetsher / keyboard_modifiers_status

Gnome-Shell extension that shows keyboard modifiers status. It's useful when sticky keys are active.
GNU General Public License v3.0
20 stars 4 forks source link

not working with Wayland and gnome 3.36 #5

Closed xzj8b3 closed 2 years ago

xzj8b3 commented 4 years ago

It doesn't seem to be working on Wayland, if it could be updated I'd be very happy to.

sneetsher commented 4 years ago

Thank you @xzj8b3 for reporting.

xzj8b3 commented 4 years ago

Thank you @xzj8b3 for reporting.

* Could you tell me using which Distribution/Release?

* I'm going to check in Ubuntu 20.04 if I remember it has Gnome 3.36. (Also has a switch for Wayland)

I use Fedora 32 and seems to give error, it could go in co-flitto with some other extension!!

xzj8b3 commented 4 years ago

Grazie @ xzj8b3 per la segnalazione.

* Could you tell me using which Distribution/Release?

* I'm going to check in Ubuntu 20.04 if I remember it has Gnome 3.36. (Also has a switch for Wayland)

Uso Fedora 32 e sembra dare errore, potrebbe andare in co-flitto con qualche altra estensione !!

I checked, on Xorg it works properly, on Wayland it doesn't work with Fedora.

sneetsher commented 4 years ago

I could reproduce it in Ubuntu 20.04 vanilla copy. Error logged in lg (command):

TypeError: keymap is null

Looking for doc of the used function:

gdk_keymap_get_default has been deprecated since version 3.22, ref: https://developer.gnome.org/gdk3/stable/gdk3-Keyboard-Handling.html#gdk-keymap-get-for-display

But it is not the only issue the state is not updated. I will get another binding like Python or original C code.

sneetsher commented 4 years ago

Grazie @ xzj8b3 per la segnalazione.

* Could you tell me using which Distribution/Release?

* I'm going to check in Ubuntu 20.04 if I remember it has Gnome 3.36. (Also has a switch for Wayland)

Uso Fedora 32 e sembra dare errore, potrebbe andare in co-flitto con qualche altra estensione !!

I checked, on Xorg it works properly, on Wayland it doesn't work with Fedora.

Thanks for update, I have checked using a c text code. No error was raised but keymap modifiers state is always zero (0). I confirm that it is not due to a compatibility issue with other extensions, but something between gdk_keymap_get_modifier_state() & Wayland interface.

I am not quite sure if GDK had already implemented/updated such low level functions to work with both X/Wayland. I read about similar private functions (start with _ underscore) and have _wayland_ tag in the name. Documentation does not mention anything about X/Wayland differences.

My next move:

xzj8b3 commented 3 years ago

I could reproduce it in Ubuntu 20.04 vanilla copy. Error logged in lg (command):

TypeError: keymap is null

Looking for doc of the used function:

gdk_keymap_get_default has been deprecated since version 3.22, ref: https://developer.gnome.org/gdk3/stable/gdk3-Keyboard-Handling.html#gdk-keymap-get-for-display

But it is not the only issue the state is not updated. I will get another binding like Python or original C code.

But it hasn't been updated and it still doesn't work... Schermata da 2020-08-01 14-58-43

sneetsher commented 3 years ago

But it hasn't been updated and it still doesn't work...

Yeah @xzj8b3, it is still not working with Wayland.

I found a commit (from 2013) about get_modifier_state() being implemented for Wayland. However, The code of X11 is not forward-compatible with Wayland one. From what I read so far, I need extra steps (function calls & initialization) to get it working in Wayland.

xzj8b3 commented 3 years ago

I found a commit (from 2013) about get_modifier_state() being implemented for Wayland. However, The code of X11 is not forward-compatible with Wayland one. From what I read so far, I need extra steps (function calls & initialization) to get it working in Wayland. Let's hope at least for Fedora 33 or maybe sooner if she succeeds!

xzj8b3 commented 3 years ago

Ma non è stato aggiornato e ancora non funziona ...

Sì @ xzj8b3 , ancora non funziona con Wayland.

Ho trovato un commit (del 2013) sull'implementazione di get_modifier_state () per Wayland. Tuttavia, il codice di X11 non è compatibile con le versioni successive di Wayland one. Da quello che ho letto finora, ho bisogno di passaggi aggiuntivi (chiamate di funzione e inizializzazione) per farlo funzionare in Wayland.

You couldn't make it work on Wayland anymore??

sneetsher commented 3 years ago

@xzj8b3 Excuse me to be late in reply. I was so busy with work, that unable to get some rest to search more about this issue.

I was reading GTK4 documentation. They moved keymap to another parent class. So it could be the case for GTK3 as a transitional step, they left old structure but not functional. Here the page summarizing changes: https://developer.gnome.org/gtk4/3.98/migrating.html

I will give it a try probably next week, no promises.

supercheetah commented 3 years ago

I just installed this on Pop OS 20.10, but it's also not working here either. Would this be fixed by monitoring the keyboard dconf settings in /org/gnome/desktop/peripherals/keyboard?

sneetsher commented 3 years ago

@supercheetah No, it will not work that way, that's only for keyboard input keymap change. It does not track event like key press or modifiers status.

Are you using Wayland or X11 server? Could you share output of:

echo $DESKTOP_SESSION
echo $XDG_SESSION_TYPE
env | grep -i wayland 
supercheetah commented 3 years ago

Sorry for the late reply. I guess I'm not running Wayland on Pop like I thought:

pop
x11
supercheetah commented 3 years ago

Never mind about me. It does seem to work, but just not how I thought. I do see it showing the state of state keys, but not the state of accessibility keyboard preferences (in my particular case, I wanted to use it to see the state of repeat keys being on or off.)

seanh commented 2 years ago

@sneetsher Did you have a chance to look into this? I can't move to Wayland without this extension!

seanh commented 2 years ago

I opened a GNOME Shell feature request asking for the keyboard-modifiers-status functionality to be added to GNOME Shell itself: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4706

seanh commented 2 years ago

@sneetsher Note this comment from Florian Müllner:

BTW, I suspect that the extension can be adjusted to work on wayland by replacing

keymap = Gdk.Keymap.get_default();

with

const seat = Clutter.get_default_backend().get_default_seat();
keymap = seat.get_keymap();
sneetsher commented 2 years ago

Thanks @seanh for pushing report upstream, that's the best path forward.

Clutter! that's probably the missing peace, when Gnome introduce Wayland and on same time moving from GTK3 to GTK4. I couldn't get to work, but I was only reading at GTK & GDK level. I was lost.

I will test it tonight on Ubuntu.

thien-do commented 2 years ago

you guys are the best @sneetsher @seanh !

sneetsher commented 2 years ago

Finally we got a lead into a working solution from another extension code, quite easy fix just hard to find without good updated documentation and changing API code.

I will test it on 3.38, 40 and push changes soon.

@xzj8b3 @supercheetah @seanh @thien-do

sneetsher commented 2 years ago

Thank you every one being patient, the fix is pushed and release uploaded here, while still under review in gnome-shell extensions portal.

Tested it in 3.28, 3.38, 40. :) Bonus in Wayland it indicates latched and locked modifiers.

Closing this report, feel free to reopen it after trying current last release 0.0.3 (11 12 on the gnome portal)