My setup: Qemu with Spice display managed by libvirt running on Linux with X11.
I’m looking for a way to preserve key bindings in the window manager and the X server when a Qemu client is focused. A libvirt or Qemu option, a compile flag, or some X11 magic – anything.
A concrete example: when I press the keys
Mod4+1 I want the
WM to switch to tag 1. Currently, the guest receives the
as an input and the WM receives nothing.
Graphical Qemu clients (mostly Windows guests here but that
shouldn’t matter) seem to grab keyboard inputs indiscriminately
bypassing even xkb. This is obvious from the fact that these
clients ignore options like
This wreaks havoc on the window manager. E. g. when a Qemu client is focused when I cycle through clients, the WM’s bindings are rendered useless until I unfocus the offending client by shoving the mouse around. Needless to say, this breaks any keyboard-driven workflow. It’s infuriating.
Also, since inputs are now passed on to the client, all kinds of funny stuff can happen depending on what the application inside the guest chooses to do with those inputs …
Edit: Upstream seemingly considers this the desired behavior: “we grab the keyboard when we get the keyboard focus, as we want any key presses to go to the vm as soon as we have keyboard focus” – which is exactly what I intend to avoid. There is no reason as to why Spice clients should be entitled to all keyboard inputs regardless of whether they are focused.