[gnome-shell-ext] How to trap keystrokes?



Hey folks,

I'm trying to develop an extension that will hide the mouse cursor
when a keystroke is pressed and show the cursor when it moves. I think
I have the JS APIs working for the cursor show/hide, but I'm
struggling to find anything that works to trap keystrokes.

FWIW, I'm using Ubuntu 21.04 with Wayland and the default Gnome desktop.

I've tried global.stage.connect('key-press-event', () => {...});, and
while it does return a connection identifier, no keystrokes ever seem
to trigger the callback.

Any advice?

(Note, if writing a daemon does the job, I would be happy to solve it
that way, but I'm not aware of any way to hide/show the mouse cursor
from outside the gnome-shell process. I scoured d-bus for a while, but
didn't see any API that would do it.)

Thanks very much,
-adlr


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]