I’m using virt-machine to run Windows 10 on endeavouros + i3.
I installed the spice tools on the host and guest systems, I get copy/paste to work fine. The meta key becomes the Windows key but I’d like it to retain its original behaviour, since I use it for navigation. I tried disabling the Windows key in the Windows register but the host still can’t get hold of it.
Navigation on the host or on the guest? I guess you can hit CtrlAlt to release the keyboard/mouse from the guest, but that would be awkward if it’s needed frequently.
Can you give an example of what you mean by “navigation”?
I use super-left, right, up, down to move between i3 containers, but when I land on the guest machine (Windows), I’m trapped in there since the Super key acts as the Windows key. For the time being I’m “ungrabbing” keys by pressing ctr-alt to release the Super key, but it’s not ideal and above all it seem to fail randomly.
Yes, it’s an inconvenience. In your use case, it’s not ideal. Here’s a post (unanswered) that describes the same frustration:
Unfortunately, I don’t have a solution for you, but I gave it a try, so I thought I’d share my experience.
I use virt-viewer
to open my QEMU virtual machines, usually with this command (which appears in a simple menuing system I wrote as a Bash script):
/usr/bin/virt-viewer -f -w -a -H release-cursor=rctrl <name of guest>
I tried this code instead:
/usr/bin/virt-viewer -f -w -a -H release-cursor=rctrl -K Super_L= <name of guest>
It didn’t work as I had hoped, and it’s no wonder: keymap
remaps (or blocks) keypresses from the guest to the host, but you want to capture certain keypresses within the host. From the virt-viewer
manual:
-K, --keymap
Remap and/or block supplied keypresses to the host.To block a keypress simply assign an empty parameter to the srcKeySym.
Example:
–keymap=Super_L=,Alt_L=,1=Shift_L+F1,2=Shift_L+F2This will block the Super_L (typically Windows Key) and ALT_L keypresses and remap key 1
to Shift F1, 2 to Shift F2.
(In my use case, keymap
did offer a benefit: It allowed a solo press of the Super key in my guest to work as expected, to open the application menu. Unfortunately, at the same time, it blocked Super key combinations in my guest, like Super+D. This different behavior is due, I think, to my guest using xcape
to map the Super key to Alt+F1. Consequently, the host doesn’t see the keypress when the Super key is pressed alone, as the guest has already mapped it to Alt+F1.)
In various online posts, I see mention of evdev
(perhaps as an alternative to Spice
) as a way to control keyboard and mouse passthrough from the host to the guest. I have absolutely no experience with evdev
, so I offer this information only as a possible way forward.
Thanks for the detailed answer. After some fiddling I came to the conclusion that ungrabbing the keys gives the most reliable result, provided that I use some funky keys for that, i.e. not ctrl-alt nor other long presses keys. So I settled for Katakana, which I don’t use for anything. This could be done via software but I cut it short by specifying a dedicated key on my QMK keyboard (precisely: KC_LNG3 on a dedicated combo). Then it’s just a matter of setting it as the ungrabbing key in the Virtual Machine Manager preferences.