This commit is contained in:
Lorenzo Villani 2026-06-19 14:53:08 +01:00 committed by GitHub
commit ff78d7bc8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 4 deletions

View File

@ -75,7 +75,7 @@ You can also pass optional parameters
: Do not commit any changes to disk/snapshot.
**--viewer \<viewer\>**
: Choose an alternative viewer. @Options: 'spicy' (default),
: Choose an alternative SPICE viewer. @Options: 'spicy' (default),
'remote-viewer', 'none'
**--width \<width\>**
@ -259,7 +259,7 @@ These should be handled by dependencies in Trixie and later. For earlier
versions (and their derivatives):
``` shell
sudo apt-get install bash coreutils curl genisoimage grep jq mesa-utils ovmf pciutils procps python3 qemu sed socat spice-client-gtk swtpm-tools unzip usbutils util-linux xdg-user-dirs xrandr zsync
sudo apt-get install bash coreutils curl genisoimage grep jq mesa-utils ovmf pciutils procps python3 qemu sed socat spice-client-gtk swtpm-tools unzip usbutils util-linux xdg-user-dirs xrandr zsync
```
#### Install requirements on Fedora hosts
@ -784,7 +784,7 @@ Arguments
--snapshot delete <tag> : Delete a snapshot.
--snapshot info : Show disk/snapshot info.
--status-quo : Do not commit any changes to disk/snapshot.
--viewer <viewer> : Choose an alternative viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'
--viewer <viewer> : Choose an alternative SPICE viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'
--width <width> : Set VM screen width; requires '--height'
--height <height> : Set VM screen height; requires '--width'
--ssh-port <port> : Set SSH port manually

View File

@ -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:
<https://www.spice-space.org/usbredir.html#filter-string-format>.
##### Enabling SPICE redirection on NixOS
On NixOS, if you encounter this error:

View File

@ -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 &
@ -2307,7 +2313,7 @@ function usage() {
echo " --snapshot delete <tag> : Delete a snapshot."
echo " --snapshot info : Show disk/snapshot info."
echo " --status-quo : Do not commit any changes to disk/snapshot."
echo " --viewer <viewer> : Choose an alternative viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'"
echo " --viewer <viewer> : Choose an alternative SPICE viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'"
echo " --width <width> : Set VM screen width; requires '--height'"
echo " --height <height> : Set VM screen height; requires '--width'"
echo " --ssh-port <port> : Set SSH port manually"
@ -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:-}"