Open Apteryks opened 3 years ago
Interesting, simply invoking xrandr
from the command line seems to triggers the event we need. So possibly the difference I'm seeing is that GNOME Boxes doesn't probe with xrandr after resizing its window, while virt-viewer does. I'll try with virt-viewer to confirm.
Mmh, just tried with virt-manager 3.2.0, and got the same result.
OK, I ended up simply invoking xrandr -s 0
(thanks for this undocumented finding!) in a cron job every second. Ugly, but does the job.
Here's the diff on the Guix System configuration:
1 file changed, 16 insertions(+), 1 deletion(-)
gnu/system/examples/vm-image.tmpl | 17 ++++++++++++++++-
modified gnu/system/examples/vm-image.tmpl
@@ -5,7 +5,7 @@
;;
(use-modules (gnu) (guix) (srfi srfi-1))
-(use-service-modules desktop networking spice ssh xorg)
+(use-service-modules desktop mcron networking spice ssh xorg)
(use-package-modules bootloaders certs fonts nvi
package-management wget xorg)
@@ -24,6 +24,18 @@ Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
accounts.\x1b[0m
"))
+;;; XXX: Xfce does not implement what is needed for the SPICE dynamic
+;;; resolution to work (see:
+;;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142). Workaround it
+;;; by manually invoking xrandr every second.
+(define auto-update-resolution-crutch
+ #~(job '(next-second)
+ (lambda ()
+ (setenv "DISPLAY" ":0.0")
+ (setenv "XAUTHORITY" "/home/guest/.Xauthority")
+ (execl (string-append #$xrandr "/bin/xrandr") "xrandr" "-s" "0"))
+ #:user "guest"))
+
(operating-system
(host-name "gnu")
(timezone "Etc/UTC")
@@ -89,6 +101,9 @@ root ALL=(ALL) ALL
;; integration with the host, etc.
(service spice-vdagent-service-type)
+ (simple-service 'cron-jobs mcron-service-type
+ (list auto-update-resolution-crutch))
+
;; Use the DHCP client service rather than NetworkManager.
(service dhcp-client-service-type))
Sorry, it seems I did not get notifications about this issue and so I totally overlooked it.
If xev -root -event randr
does not generate any output in gnome-boxes upon resolution changes, then I don't know how to trigger the actual resolution change.
I'll try to take a look at what plain "xrandr" does and maybe, if it is "cheap enough", I can just add that to spice-autorandr so that it gets called every few seconds, at least until we got our first event (assuming that if the event arrives once, it will arrive later again).
Hi @seife; I've come up with my own solution in https://gitlab.com/Apteryks/x-resize/ that relies on the 'drm' udev events and calling xrandr -s 0
. I've tested it with GNOME Boxes and virt-manager, and also made sure it didn't interfere with non-SPICE viewers such as the plain QEMU viewer. Perhaps it can be of use to your project as well.
I hope the latest commit fixes this issue :-)
Hello, and thank your for this promising workaround.
I'm trying to have it work on Xfce, but it seems it only changes the resolution when it is started. I figured out it must be missing events so I used the following command:
xev -root -event randr
but it doesn't catch any randr events upon changing the guest window size (GNOME Boxes).
Any ideas of what else to to look for to debug this?