unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Diego Nicola Barbato <dnbarbato@posteo.de>
To: 35493@debbugs.gnu.org
Subject: [bug#35493] [PATCH 2/3] services: slim: Allow SLiM to be started on multiple ttys.
Date: Mon, 29 Apr 2019 20:20:51 +0200	[thread overview]
Message-ID: <87y33s8ygs.fsf@GlaDOS.home> (raw)
In-Reply-To: <871s1kad42.fsf@GlaDOS.home>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0002-services-slim-Allow-SLiM-to-be-started-on-multiple-t.patch --]
[-- Type: text/x-patch, Size: 6078 bytes --]

From fddb8de350bcf5c89932e032b3fe2ad4dc7c91dd Mon Sep 17 00:00:00 2001
From: Diego Nicola Barbato <dnbarbato@posteo.de>
Date: Sun, 28 Apr 2019 15:52:50 +0200
Subject: [PATCH 2/3] services: slim: Allow SLiM to be started on multiple
 ttys.

This change makes it possible to add multiple SLiM services to an operating
system configuration by setting the new 'display' and 'vt' fields in their
configurations to different values.  Each SLiM service will get its own
authfile, logfile, lockfile, and shepherd service, which will start SLiM on a
different tty.

* gnu/services/xorg.scm: Export slim-configuration-display and
  slim-configuration-vt.
  (<slim-configuration>)[display, vt]: New fields.
  (slim-shepherd-service): Refactor let.
  [slim.cfg]: Use new fields for setting display_name, xserver_arguments,
  authfile, lockfile, and logfile.
  [shepherd-service][provision]: Name the shepherd service according to the
  value of 'vt'.
  [shepherd-service][start]: Delete the right lockfile.
---
 gnu/services/xorg.scm | 85 +++++++++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 36 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 44dcec4ec9..65e9d48915 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -83,6 +83,8 @@
             slim-configuration-shepherd
             slim-configuration-auto-login-session
             slim-configuration-xorg
+            slim-configuration-display
+            slim-configuration-vt
             slim-configuration-sessreg
 
             slim-service-type
@@ -488,6 +490,10 @@ desktop session from the system or user profile will be used."
                       (default #f))
   (xorg-configuration slim-configuration-xorg
                       (default (xorg-configuration)))
+  (display slim-configuration-display
+           (default ":0"))
+  (vt slim-configuration-vt
+      (default "vt7"))
   (sessreg slim-configuration-sessreg
            (default sessreg)))
 
@@ -499,20 +505,26 @@ desktop session from the system or user profile will be used."
          (slim-configuration-allow-empty-passwords? config))))
 
 (define (slim-shepherd-service config)
-  (define slim.cfg
-    (let ((xinitrc (xinitrc #:fallback-session
-                            (slim-configuration-auto-login-session config)))
-          (xauth   (slim-configuration-xauth config))
-          (startx  (xorg-start-command (slim-configuration-xorg config)))
-          (shepherd   (slim-configuration-shepherd config))
-          (theme-name (slim-configuration-theme-name config))
-          (sessreg (slim-configuration-sessreg config)))
+  (let* ((xinitrc (xinitrc #:fallback-session
+                           (slim-configuration-auto-login-session config)))
+         (xauth   (slim-configuration-xauth config))
+         (startx  (xorg-start-command (slim-configuration-xorg config)))
+         (display (slim-configuration-display config))
+         (vt (slim-configuration-vt config))
+         (shepherd   (slim-configuration-shepherd config))
+         (theme-name (slim-configuration-theme-name config))
+         (sessreg (slim-configuration-sessreg config))
+         (lockfile (string-append "/var/run/slim-" vt ".lock")))
+    (define slim.cfg
       (mixed-text-file "slim.cfg"  "
 default_path /run/current-system/profile/bin
 default_xserver " startx "
-xserver_arguments :0 vt7
+display_name " display "
+xserver_arguments " vt "
 xauth_path " xauth "/bin/xauth
-authfile /var/run/slim.auth
+authfile /var/run/slim-" vt ".auth
+lockfile " lockfile "
+logfile /var/log/slim-" vt ".log
 
 # The login command.  '%session' is replaced by the chosen session name, one
 # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
@@ -530,32 +542,33 @@ reboot_cmd " shepherd "/sbin/reboot\n"
     "")
 (if theme-name
     (string-append "current_theme " theme-name "\n")
-    ""))))
-
-  (define theme
-    (slim-configuration-theme config))
-
-  (list (shepherd-service
-         (documentation "Xorg display server")
-         (provision '(xorg-server))
-         (requirement '(user-processes host-name udev))
-         (start
-          #~(lambda ()
-              ;; A stale lock file can prevent SLiM from starting, so remove it to
-              ;; be on the safe side.
-              (false-if-exception (delete-file "/var/run/slim.lock"))
-
-              (fork+exec-command
-               (list (string-append #$(slim-configuration-slim config)
-                                    "/bin/slim")
-                     "-nodaemon")
-               #:environment-variables
-               (list (string-append "SLIM_CFGFILE=" #$slim.cfg)
-                     #$@(if theme
-                            (list #~(string-append "SLIM_THEMESDIR=" #$theme))
-                            #~())))))
-         (stop #~(make-kill-destructor))
-         (respawn? #t))))
+    "")))
+
+    (define theme
+      (slim-configuration-theme config))
+
+    (list (shepherd-service
+           (documentation "Xorg display server")
+           (provision (list (symbol-append 'xorg-server-
+                                           (string->symbol vt))))
+           (requirement '(user-processes host-name udev))
+           (start
+            #~(lambda ()
+                ;; A stale lock file can prevent SLiM from starting, so remove it to
+                ;; be on the safe side.
+                (false-if-exception (delete-file lockfile))
+
+                (fork+exec-command
+                 (list (string-append #$(slim-configuration-slim config)
+                                      "/bin/slim")
+                       "-nodaemon")
+                 #:environment-variables
+                 (list (string-append "SLIM_CFGFILE=" #$slim.cfg)
+                       #$@(if theme
+                              (list #~(string-append "SLIM_THEMESDIR=" #$theme))
+                              #~())))))
+           (stop #~(make-kill-destructor))
+           (respawn? #t)))))
 
 (define slim-service-type
   (service-type (name 'slim)
-- 
2.21.0

  parent reply	other threads:[~2019-04-29 18:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 18:19 [bug#35493] [PATCH 0/3] Allow multiple SLiM services Diego Nicola Barbato
2019-04-29 18:20 ` [bug#35493] [PATCH 1/3] gnu: slim: Allow customisation of Xorg display Diego Nicola Barbato
2019-05-06  8:35   ` Ludovic Courtès
2019-05-06 11:31     ` Diego Nicola Barbato
2019-05-07 13:55       ` Ludovic Courtès
2019-05-07 21:54         ` Diego Nicola Barbato
2019-05-08 10:29           ` Ludovic Courtès
2019-05-08 20:12             ` Diego Nicola Barbato
2019-05-09 10:19               ` bug#35493: " Ludovic Courtès
2019-04-29 18:20 ` Diego Nicola Barbato [this message]
2019-04-29 18:20 ` [bug#35493] [PATCH 3/3] doc: Document 'display' and 'vt' fields of 'slim-configuration' Diego Nicola Barbato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y33s8ygs.fsf@GlaDOS.home \
    --to=dnbarbato@posteo.de \
    --cc=35493@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).