From 99f2d2e3945ac6c2344ce98cb39b570d4416e70d Mon Sep 17 00:00:00 2001 From: Lorenzo Villani Date: Fri, 29 Aug 2025 19:11:18 +0200 Subject: [PATCH] feat(quickemu): add support for passing extra arguments to the SPICE viewer --- docs/quickemu_conf.5.md | 13 +++++++++++++ quickemu | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/docs/quickemu_conf.5.md b/docs/quickemu_conf.5.md index 8f67dab..352e0da 100644 --- a/docs/quickemu_conf.5.md +++ b/docs/quickemu_conf.5.md @@ -46,6 +46,7 @@ secureboot="off" tpm="off" usb_devices=() viewer="spicy" +viewer_extra_args="" ssh_port="" spice_port="" public_dir="" @@ -273,6 +274,18 @@ device selection*) support this feature. To ensure that this functionality works as expected, make sure that you have installed the necessary SPICE Guest Tools on the virtual machine. +Automatic redirection of specific devices can be configured in the +configuration file by setting the `viewer_extra_args` variable. + +For example (in the configuration file): + + viewer_extra_args="--spice-usbredir-redirect-on-connect=-1,0x1234,0x5678,-1,1" + +Where `0x1234` and `0x5678` are example USB VID and PID, respectively. + +The string format is described at: +. + ##### Enabling SPICE redirection on NixOS On NixOS, if you encounter this error: diff --git a/quickemu b/quickemu index ee66a3a..bec6198 100755 --- a/quickemu +++ b/quickemu @@ -2243,6 +2243,12 @@ function start_viewer { viewer_args+=("${viewer_uri}") fi + # Add extra arguments + if [ -n "${viewer_extra_args}" ]; then + # shellcheck disable=SC2206 + viewer_args+=(${viewer_extra_args}) + fi + # Launch the viewer echo " - Viewer: ${viewer} ${viewer_args[*]} >/dev/null 2>&1 &" "${viewer}" "${viewer_args[@]}" >/dev/null 2>&1 & @@ -2550,6 +2556,7 @@ secureboot="off" tpm="off" usb_devices=() viewer="${viewer:-spicy}" +viewer_extra_args="${viewer_extra_args:-}" width="${width:-}" height="${height:-}" ssh_port="${ssh_port:-}"