Open Jahfry opened 2 years ago
Quick pointers on setting this up would be grand, but a simple "yep, that should be doable" will be enough to get me to install and do more research. I just want to avoid spending time on it if the answer is "not going to work".
Thanks!
Yep, that should be doable*.
Something like the following script can be used to use different hotkeys to switch to different VMs. It toggles the events between VM 1/2 by left+right control, and jumps to the host by using leftctlr+esc.
evsieve --input /dev/input/by-id/keyboard persist=reopen \
--toggle "" @vm1 @vm2 @host \
--hook key:leftctrl@vm1 key:rightctrl@vm1 toggle=:2 \
--hook key:leftctrl@vm2 key:rightctrl@vm2 toggle=:1 \
--hook key:leftctrl@host key:rightctrl@host toggle=:1 \
--hook key:leftctrl key:esc toggle=:3 \
--output @vm1 create-link=/dev/input/by-id/vm-kb-1 \
--output @vm2 create-link=/dev/input/by-id/vm-kb-2 \
--output @host create-link=/dev/input/by-id/host-kb
By specifying the domain of the events that trigger the hooks, it ensures that certain hooks only trigger when a specific VM is active, and uses the toggle=:number
functionality to set all toggles to a specific index instead of just the next one.
As for focusing the input on a specific VM during startup: this is not possible on the stable version of evsieve yet, but on the main branch there is a half-baked --control-fifo
argument that can accomplish this:
evsieve --input /dev/input/by-id/keyboard persist=reopen \
--toggle "" @vm1 @vm2 @host \
--hook key:leftctrl@vm1 key:rightctrl@vm1 toggle=:2 \
--hook key:leftctrl@vm2 key:rightctrl@vm2 toggle=:1 \
--hook key:leftctrl@host key:rightctrl@host toggle=:1 \
--hook key:leftctrl key:esc toggle=:3 \
--output @vm1 create-link=/dev/input/by-id/vm-kb-1 \
--output @vm2 create-link=/dev/input/by-id/vm-kb-2 \
--output @host create-link=/dev/input/by-id/host-kb \
--control-fifo /tmp/evsieve-control-fifo
You can then change the active map to e.g. the second VM by running echo toggle :2 > /tmp/evsieve-control-fifo
as root or echo toggle :2 | sudo tee /tmp/evsieve-control-fifo > /dev/null
as a normal user (with sudo access.)
(--control-fifo
was originally introduced here and its design is still as unfinished as it was a month ago.)
Hi, I used evsieve in my KVM setup. I can switch keyboard & display between host and VMs using evsieve. I created my own system service to load different evsieve mapping. Here is my repository, maybe you will find some inspiration how to do it.
Apologies if there is a better place to put basic questions, I didn't see one when looking.
I'm curious if evsieve can support a workflow I'm trying to build.
I have a system where the host (Proxmox as a hypervisor) is running headless. I'd still like to be able to use the same keyboard on the host in emergencies but will need it there far less than 1% of the time.
I'm running multiple VFIO (passthrough) VMs via a couple of GPUs.
I'd like to be able to:
1) Is there a way to cycle multiple VM inputs using a hotkey?
2) If yes, can the host cycle hotkey be different than the VM switching hotkey?
To explain the workflow differently:
I'd be setting a VM up to run on Proxmox boot up. Only 1 VM would be running at this point. I'd like to focus evsieve to immediately control that VM (using hookscript most likely). I could spin up a second VM and use a hotkey to switch input to it. Later I might shut down one of the VMs to spin up a different one, but still have ability to switch to it.
In the case of some weird emergency I'd have a different hotkey that would always focus the inputs back to the Proxmox host.