Compartmentalization pickle: Keyboard shortcut for USB-keyboard-to-VM allocation?

Hi all,

I have one group of apps that I frequently type a lot in that needs network access, and another group of apps that I also frequently type a lot in that I do not want to have network access.

I do not want to put both groups of apps into one VM, in order to keep network access compartmentalized as described above.

I want / need to use a USB keyboard for both groups of apps.

I would prefer to stay away from connecting the USB keyboard to dom0.

I believe it is not possible to connect the USB keyboard with both VMs at the same time. Even if that were possible that doesn’t seem like the best idea anyway, because that would introduce a potential path for the compartmentalization between those two VMs to be broken down via USB vulnerabilities.

Does all this mean that I am stuck with either:

a) Using the external keyboard for only one of those VMs and the laptop keyboard for the other


b) Manually switching the USB keyboard forth and back between both VMs as needed via the Qubes Devices manager (which is too slow a process for me seeing how often I go between those two VMs)?

Is there another way to use the USB keyboard in both VMs alternatingly?

Is it possible to set up a keyboard shortcut that does the re-allocation of the USB keyboard to one or the other VM, so I don’t need to mouse click my way through the Devices Manager every time I switch?

A quick to use USB keyboard to VM allocation shortcut like “Ctrl + Z + C” to attach the USB keyboard to VM1, “Ctrl + Z + V” to attach the USB keyboard to VM2 would be really helpful.

(I wonder if this would be a worthwhile feature to add to Qubes preinstalled at some point. It might help encourage more users not to attach a USB keyboard to dom0 as well, by making not doing that a bit less of a hassle.)

I know that I might be asking for the impossible here. Just checking if I’m overlooking some option.

Hope your day is going well!


Of course.

Instead of this use usb qube.
Write a simple script that uses qvm-usb to attach and detach the
devices as needed.
Allocate the script to a shortcut - In Xfce it’s
configuration->Keyboard, in KDE it’s Settings->Shortcuts.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.

Ha, thank you for your input, but unfortunately you are overestimating my current abilities here. It’s been a very long time since I have written any code at all.

I might (re-)learn this at some point, but not right now.

But I’m not asking you to write the script for me, it’s really ok.

I just wanted to know if there’s a simple built-in way for doing this already that I just need to know about.

For the time being I’m settling for attaching the USB keyboard to one VM, and using the laptop keyboard for everything else. It’ll have to do for the time being, and in my view far preferable than attaching the USB keyboard to dom0.

Have a nice day, wherever you are :slight_smile: