GNU bug report logs -
#77266
[PATCH] gnu: Merge xorg configurations when extending.
Previous Next
Reported by: Ian Eure <ian <at> retrospec.tv>
Date: Wed, 26 Mar 2025 04:25:02 UTC
Severity: normal
Tags: patch
Done: Ian Eure <ian <at> retrospec.tv>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Configuration for xorg is embedded in the various display-manager
configuration records, and extension support is factored out into the
`handle-xorg-configuration' macro. However, the extension mechanism replaces
the existing xorg-configuration with the supplied one, making it impossible to
compose configuration from multiple sources. This patch adds a procedure to
merge two xorg-configuration records, and calls it within
handle-xorg-configuration, allowing the config to be built piecemeal.
* gnu/services/xorg.scm (merge-xorg-configurations): New variable.
(handle-xorg-configuration): Merge xorg configs.
Change-Id: I20e9db911eef5d4efe98fdf382f3084e4defc1ba
---
gnu/services/xorg.scm | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index bef05b9bb9..dbd1513cc8 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -209,6 +209,34 @@ (define-record-type* <xorg-configuration>
(server-arguments xorg-configuration-server-arguments ;list of strings
(default %default-xorg-server-arguments)))
+(define (merge-xorg-configurations a b)
+ (let ((configs (list a b)))
+ (xorg-configuration
+ (modules
+ (delete-duplicates (append-map xorg-configuration-modules configs)))
+ (fonts
+ (delete-duplicates (append-map xorg-configuration-fonts configs)))
+ (drivers
+ (delete-duplicates (append-map xorg-configuration-drivers configs)))
+ (resolutions
+ (delete-duplicates (append-map xorg-configuration-resolutions configs)))
+ (extra-config (append-map xorg-configuration-extra-config configs))
+ ;; Prefer the more recently set layout.
+ (keyboard-layout (or (xorg-configuration-keyboard-layout b)
+ (xorg-configuration-keyboard-layout a)
+ #f))
+ (server
+ ;; Prefer the non-default server.
+ (if (eq? xorg-server (xorg-configuration-server a))
+ (xorg-configuration-server b)
+ (xorg-configuration-server a)))
+ (server-arguments
+ ;; Prefer the non-default arguments.
+ (if (eq? %default-xorg-server-arguments
+ (xorg-configuration-server-arguments a))
+ (xorg-configuration-server-arguments b)
+ (xorg-configuration-server-arguments a))))))
+
(define (xorg-configuration->file config)
"Compute an Xorg configuration file corresponding to CONFIG, an
<xorg-configuration> record."
@@ -628,10 +656,7 @@ (define-syntax handle-xorg-configuration
((_ configuration-record service-type-definition)
(service-type
(inherit service-type-definition)
- (compose (lambda (extensions)
- (match extensions
- (() #f)
- ((config . _) config))))
+ (compose (cut reduce merge-xorg-configurations #f <>))
(extend (lambda (config xorg-configuration)
(if xorg-configuration
(configuration-record
--
2.48.1
This bug report was last modified 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.