Small tip for getting SPICE screen resizing to work with KDE in Debian 12.5

justinclift

Well-Known Member
Apr 1, 2024
653
180
48
Stumbled across a weird behaviour with Debian 12.5 VM's today when using SPICE with KDE.

Resizing the virtual screen (eg dragging virt-viewer window to be a new size) wouldn't trigger the (useful) automatic screen resizing that's present by default in GNOME. Ugh.

It turned out two things were needed:

1. Manual installation of the spice-vdagent package, as that's what does the screen resizing

Code:
$ sudo apt -y install spice-vdagent

2. Modification of the .desktop file so it launches upon log in

In theory, the text file /etc/xdg/autostart/spice-vdagent.desktop should cause spice-vdagent (client side user agent software) to launch when you log in.

But it seems like there's some kind of bug, as the presence of a GNOME related field in it is blocking the launch by KDE.

The complete file at install time is this:

Code:
[Desktop Entry]
Name=Spice vdagent
Comment=Agent for Spice guests
Exec=/usr/bin/spice-vdagent
Terminal=false
Type=Application
Categories=
X-GNOME-Autostart-Phase=WindowManager
NoDisplay=true

After removing (or commenting out) that X-GNOME-Autostart-Phase=WindowManager line then rebooting, screen resizing automagically works from then on in KDE.

Ironically, GNOME doesn't seem to need that line either, as screen resizing seems to continue working fine in GNOME anyway without it.

Hopefully the above helps anyone else who stumbles over this particular bug and needs a workaround. I haven't bothered digging into this further and reporting an appropriate bug upstream anywhere, so if someone else wants to they're more than welcome. :)
 
Last edited: