CapsLock is sent twice when binded to ESC on the host.
I like to use Vim as my editor, so I always bind CapsLock to ESC on my system. However, there seems to be a frustrating bug on Spice regarding this:
Whenever I press CapsLock the key is sent to the guest as expected, but after a few seconds, the same keystroke is sent again to the guest. This is frustrating because if you exit insert mode (esc), move to a different line and enter insert mode again, it will send you back to normal mode after the CapsLock keystroke is resent.
I've attached a small video demonstrating the issue. Left terminal is running evtest on the host (Fedora 34), Right terminal is running evtest on the guest (ParrotOS). As you can see, there is a CAPS_LOCK keystroke being sent to the Guest, without the Host sending any input
I've traced back the issue to spice after following this guide on virt-manager repo. The same problem occurs on virt-manager and virt-viewer. If I change my settings to use VNC instead of Spice, the problem no longer occurs, however I prefer using Spice as my viewer because of the cool and useful feature of automatic resolution adjustment (even though I need to manually trigger it with a command), and because mouse doesn't work properly on vnc for me.
What I have tried:
- Binding CapsLock to Esc on both the Guest and the Host causes the issue (current environment)
- Binding CapsLock to Esc only on the Host causes the same issue.
- Binding CapsLock to Esc only on the Guest fixes the issue, but CapsLock is also triggered on the Host even tho I'm sending it to the guest. (This is not a real fix for me because I would prefer to bind CapsLock to ESC on both Host and Guest, as I rarely use CapsLock and I dont really like it being enabled)
- Leaving CapsLock key as default doesn't causes any double-sent keystrokes, however, as mentioned above, this is not a real fix for me, because I need it to be binded to Esc)
- Stopping spice-vdagentd dont fix the issue
- Stopping qemu-ga dont fix the issue
- Changing Spice to use OpenGL dont fix the issue and raises a new Selinux warn about execmem
I'm currently binding CapsLock to Esc using "xmodmap ~/.Xmodmap" where ~/.Xmodmap is a file containing the following rules:
clear Lock keycode 0x42 = Escape
- Host kernel: 5.15.6-100.fc34.x86_64
- Guest kernel: 5.14.0-9parrot1-amd64
- Virt-Manager: 3.2.0