guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch version-1.3.0 updated: system: vm-image.tmpl: Add a crutch to all


From: guix-commits
Subject: branch version-1.3.0 updated: system: vm-image.tmpl: Add a crutch to allow refreshing the resolution.
Date: Mon, 10 May 2021 10:19:29 -0400

This is an automated email from the git hooks/post-receive script.

apteryx pushed a commit to branch version-1.3.0
in repository guix.

The following commit(s) were added to refs/heads/version-1.3.0 by this push:
     new 945ad48  system: vm-image.tmpl: Add a crutch to allow refreshing the 
resolution.
945ad48 is described below

commit 945ad48cd8029fa77a643e00c7fd350e98cacca0
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sun May 9 23:40:34 2021 -0400

    system: vm-image.tmpl: Add a crutch to allow refreshing the resolution.
    
    Inspired by
    
https://github.com/jollheef/appvm/commit/1270b2e209bc002e69bbe6351ad5b04b7facfcc8.
    The price to pay is about 5% of a CPU core usage in the guest in the worst
    scenario.
    
    * gnu/system/examples/vm-image.tmpl
    (auto-update-resolution-crutch): New mcron job.
    [services]: Extend the mcron-service with it.
---
 gnu/system/examples/vm-image.tmpl | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/system/examples/vm-image.tmpl 
b/gnu/system/examples/vm-image.tmpl
index 1a2dfca..697019e 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/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))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]