More on this, the autostart works but it only works for increasing in
size, if I decrease it doesn't.
I have found another workaround here
https://superuser.com/questions/1183834/no-auto-resize-with-spice-and-virt-manager
which involves adding a script to watch for display events and trigger
xrandr
#!/bin/sh
sleep 2
xrandr --output "$(xrandr | awk '/ connected/{print $1; exit; }')" --auto
xev -root -event randr | \
grep --line-buffered 'subtype XRROutputChangeNotifyEvent' | \
while read foo ; do \
xrandr --output "$(xrandr | awk '/ connected/{print $1; exit; }')"
--auto
done
Below is the debug log for spice-vdagent when the script isn't in use.
spice-vdagent[1776]: Root size of screen 0 changed to 1920x1080 send 1
spice-vdagent[1776]: display: failed to call GetCurrentState from mutter
over DBUS
spice-vdagent[1776]: error message: Cannot invoke method; proxy is
for the well-known name org.gnome.Mutter.DisplayConfig without an owner,
and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag
spice-vdagent[1776]: Unable to find a display id for output index 2)
spice-vdagent[1776]: Unable to find a display id for output index 3)
spice-vdagent[1776]: Sending guest screen resolutions to vdagentd:
spice-vdagent[1776]: display_id=0 - 1920x1080+0+0
spice-vdagent[1776]: display_id=1 - 0x0+0+0
spice-vdagent[1776]: 0x563e06c189e0 sent guest xorg resolution, arg1:
1920, arg2: 1080, size 40
spice-vdagent[1776]: display: failed to call GetCurrentState from mutter
over DBUS
spice-vdagent[1776]: error message: Cannot invoke method; proxy is
for the well-known name org.gnome.Mutter.DisplayConfig without an owner,
and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag
spice-vdagent[1776]: Unable to find a display id for output index 2)
spice-vdagent[1776]: Unable to find a display id for output index 3)
spice-vdagent[1776]: Sending guest screen resolutions to vdagentd:
spice-vdagent[1776]: display_id=0 - 1920x1080+0+0
spice-vdagent[1776]: display_id=1 - 0x0+0+0
spice-vdagent[1776]: 0x563e06c189e0 sent guest xorg resolution, arg1:
1920, arg2: 1080, size 40