Subject: Re: [bug#35493] [PATCH 1/3] gnu: slim: Allow customisation of Xorg display.

From: Diego Nicola Barbato <[email-masked]>
Date: Tue, 07 May 2019 23:54:36 +0200

Hi Ludo,

Ludovic Courtès <[email-masked]> writes:

> Hi Diego,
>
> Diego Nicola Barbato <[email-masked]> skribis:
>
>> Ludovic Courtès <[email-masked]> writes:
>
> [...]
>
>>> The patch LGTM.  Just one question: did you submit it upstream (is there
>>> still an upstream?), and if so, could we add the URL of upstream’s
>>> tracking software or an indication about the submission?
>>
>> I did not submit it upstream (the most likely candidate seems to be this
>> [0] even though it is not mentioned e.g. on the ArchWiki), since the
>> general consensus seems to be that the project has been abandoned.
>
> That makes sense.
>
> I’ve applied the 3 patches and confirmed that
> gnu/system/examples/vm-image.tmpl, which uses SLiM, still works
> correctly.
>
> However, I’ve noticed that this changes the name of the default Shepherd
> service from ‘xorg-server’ to ‘xorg-server-vt7’.
>
> What about generating an ‘xorg-server’ Shepherd service that would
> depend on all the ‘xorg-server-vtN’ services?  Hmm that wouldn’t be
> entirely equivalent: ‘herd start xorg-server’ would start them all, but
> ‘herd stop xorg-server’ wouldn’t stop any of them.
>
> Perhaps a simple fix is, when there’s only one server launched, to have
> the Shepherd service provide both ‘xorg-server-vtN’ and ‘xorg-server’.
> Or to special-case vt7 such that the service for vt7 provides both
> ‘xorg-server’ and ‘xorg-server-vt7’.
>
> Thoughts?

How about changing the default value of vt to #f and having the Shepherd
service provide ‘xorg-server-vtN’ only if vt is set to "vtN" and
‘xorg-server’ otherwise.  That way the name of the default Shepherd
service would not change.

I have attached a patch that does just that.  If we apply it we will
also have to update the documentation to reflect the change of vt's
default value.

Regards,

Diego

>From 14d0106f53ee17aea8f176745bf6dd5d8a748965 Mon Sep 17 00:00:00 2001
From: Diego Nicola Barbato <[email-masked]>
Date: Tue, 7 May 2019 22:22:48 +0200
Subject: [PATCH] services: slim: Make default Shepherd service provide
 'xorg-server'.

Commit 6426a8fb6c changed the name of the default Shepherd service from
'xorg-server' to 'xorg-server-vt7'.  This patch changes it back.

* gnu/services/xorg.scm (define-module): Use module (ice-9 format).
  (<slim-configuration>)[vt]: Change default value to #f.
  (slim-shepherd-service)[shepherd-service][provision]: Provide
  'xorg-server-vtN' if vt is set to "vtN" and 'xorg-server' if vt is #f.
---
 gnu/services/xorg.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 65e9d48915..81e38665c9 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -52,6 +52,7 @@
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 format)
   #:export (xorg-configuration
             xorg-configuration?
             xorg-configuration-modules
@@ -493,7 +494,7 @@ desktop session from the system or user profile will be used."
   (display slim-configuration-display
            (default ":0"))
   (vt slim-configuration-vt
-      (default "vt7"))
+      (default #f))
   (sessreg slim-configuration-sessreg
            (default sessreg)))
 
@@ -510,7 +511,8 @@ desktop session from the system or user profile will be used."
          (xauth   (slim-configuration-xauth config))
          (startx  (xorg-start-command (slim-configuration-xorg config)))
          (display (slim-configuration-display config))
-         (vt (slim-configuration-vt config))
+         (vt? (slim-configuration-vt config))
+         (vt (or vt? "vt7"))
          (shepherd   (slim-configuration-shepherd config))
          (theme-name (slim-configuration-theme-name config))
          (sessreg (slim-configuration-sessreg config))
@@ -549,8 +551,8 @@ reboot_cmd " shepherd "/sbin/reboot\n"
 
     (list (shepherd-service
            (documentation "Xorg display server")
-           (provision (list (symbol-append 'xorg-server-
-                                           (string->symbol vt))))
+           (provision (list (string->symbol
+                             (format #f "xorg-server~@[-~a~]" vt?))))
            (requirement '(user-processes host-name udev))
            (start
             #~(lambda ()
-- 
2.21.0