Have keyboard events "bypass" grabbed pointer

Lukas Barth lists at tinloaf.de
Tue Feb 14 14:27:17 UTC 2017

Hi everyone,

I'm trying to patch an application that uses xcb_grab_keyboard at the
root window to grab all key presses (i.e., a screen locker). What I want
to achieve is that certain key press events (e.g. some media keys) are
nonetheless being passed to the root window (i.e., my window manager) so
that I can do some actions even when the screen is locked.

I tried using xcb_test_fake_input(…, …, …, …, root_window, …, …, …)
inside the screen locker to "replay" those key presses to the root
window, but the fake events seem to pass through the same queue as the 
real events and thus end up in the screen locker instead of the root 
window. Is that the case? I might have botched something else and faking 
those inputs should actually work?

Do you know of any way to still send key press events to the root
window, even if the keyboard pointer is grabbed away?

Alternatively, is there a way of listening to key press events even if
some other process has grabbed the input pointer? I would even be fine 
with building a small daemon that listens for these events and then acts
accordingly - I do not necessarily need the events to reach my window
manager. However, I would rather not implement this said daemon inside
my screen locker…

Thanks for any help,


More information about the xorg mailing list