I am running Arch Linux on my host system with GNOME on Wayland and a Kali Linux VM with GNOME on X11, using QEMU/KVM with Virtual Machine Manager. On my host system, I have remapped Caps Lock to Escape using caps:escape
, which works as expected. However, when I apply the same remapping inside the VM using setxkbmap
, pressing Caps Lock results in two Escape key events: one immediately and another one after about one second.
If I don’t remap Caps Lock inside the VM, it functions normally as Caps Lock, meaning the issue only occurs when applying the remapping inside the VM. I suspect this might be due to the interaction between the host’s keyboard configuration and how input is handled within the VM under X11.
Additionally, I noticed that my VM is using a PS/2 keyboard, which might be causing the issue. However, I am unable to replace it in Virtual Machine Manager, even when editing the VM's XML configuration—after replacing the PS/2 keyboard, it gets re-added automatically.
Why does this happen, and how can I properly remap Caps Lock to Escape inside the VM without triggering duplicate Escape key events? Also, is there a way to change the keyboard type in Virtual Machine Manager to avoid potential issues with the PS/2 keyboard?