unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir.
@ 2015-03-08 14:14 宋文武
  2015-03-08 14:14 ` [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command 宋文武
  2015-03-10  8:46 ` [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: 宋文武 @ 2015-03-08 14:14 UTC (permalink / raw)
  To: guix-devel

* gnu/services/xorg.scm (<session-type>, %windowmaker-session-type)
  (%ratposion-session-type, %sawfish-session-type, %default-xsessions)
  (xsessions-directory): Remove.
  (slim-service): Remove #:sessions parameter.
  [slim.cfg]: Use /run/current-system/profile/share/xsessions as sessiondir.
* doc/guix.texi <X Window>: Adjust accordingly.
---
 doc/guix.texi         | 23 +--------------
 gnu/services/xorg.scm | 78 +++------------------------------------------------
 2 files changed, 5 insertions(+), 96 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bd8091a..98cce98 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4618,8 +4618,7 @@ started by the @dfn{login manager}, currently SLiM.
 @deffn {Monadic Procedure} slim-service [#:allow-empty-passwords? #f] @
   [#:auto-login? #f] [#:default-user ""] [#:startx] @
   [#:theme @var{%default-slim-theme}] @
-  [#:theme-name @var{%default-slim-theme-name}] @
-  [#:sessions @var{%default-sessions}]
+  [#:theme-name @var{%default-slim-theme-name}]
 Return a service that spawns the SLiM graphical login manager, which in
 turn starts the X display server with @var{startx}, a command as returned by
 @code{xorg-start-command}.
@@ -4632,28 +4631,8 @@ If @var{theme} is @code{#f}, the use the default log-in theme; otherwise
 @var{theme} must be a gexp denoting the name of a directory containing the
 theme to use.  In that case, @var{theme-name} specifies the name of the
 theme.
-
-Last, @var{session} is a list of @code{<session-type>} objects denoting the
-available session types that can be chosen from the log-in screen.  The first
-one is chosen by default.
 @end deffn
 
-@defvr {Scheme Variable} %default-sessions
-The list of default session types used by SLiM.
-@end defvr
-
-@defvr {Scheme Variable} %ratpoison-session-type
-Session type using the Ratpoison window manager.
-@end defvr
-
-@defvr {Scheme Variable} %windowmaker-session-type
-Session type using the WindowMaker window manager.
-@end defvr
-
-@defvr {Scheme Variable} %sawfish-session-type
-Session type using the Sawfish window manager.
-@end defvr
-
 @defvr {Scheme Variable} %default-theme
 @defvrx {Scheme Variable} %default-theme-name
 The G-Expression denoting the default SLiM theme and its name.
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 562f57f..912cbd3 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,9 +26,7 @@
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages slim)
-  #:use-module (gnu packages ratpoison)
   #:use-module (gnu packages gnustep)
-  #:use-module (gnu packages sawfish)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages bash)
   #:use-module (guix gexp)
@@ -39,14 +38,6 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match)
   #:export (xorg-start-command
-            %default-xsessions
-            %ratpoison-session-type
-            %windowmaker-session-type
-            %sawfish-session-type
-
-            session-type?
-            session-type-name
-
             %default-slim-theme
             %default-slim-theme-name
             slim-service))
@@ -194,61 +185,6 @@ which should be passed to this script as the first argument.  If not, the
 ;;; SLiM log-in manager.
 ;;;
 
-(define-record-type* <session-type> session-type make-session-type
-  session-type?
-  (name         session-type-name)                ;string
-  (executable   session-type-executable))         ;string-valued gexp
-
-(define %windowmaker-session-type
-  (session-type
-   (name "WindowMaker")
-   (executable #~(string-append #$windowmaker "/bin/wmaker"))))
-
-(define %ratpoison-session-type
-  (session-type
-   (name "Ratpoison")
-   (executable #~(string-append #$ratpoison "/bin/ratpoison"))))
-
-(define %sawfish-session-type
-  (session-type
-   (name "Sawfish")
-   (executable #~(string-append #$sawfish "/bin/sawfish"))))
-
-(define %default-xsessions
-  ;; Default session types available to the log-in manager.
-  (list %windowmaker-session-type %ratpoison-session-type))
-
-(define (xsessions-directory sessions)
-  "Return a directory containing SESSIONS, a list of <session-type> objects.
-The alphabetical order of the files in that directory match the order of the
-elements in SESSIONS."
-  (define builder
-    #~(begin
-        (use-modules (srfi srfi-1)
-                     (ice-9 format))
-
-        (mkdir #$output)
-        (chdir #$output)
-        (fold (lambda (name executable number)
-                ;; Create file names such that the order of the items in
-                ;; SESSION is respected.  SLiM gets them in lexicographic
-                ;; order and uses the first one as the default session.
-                (let ((file (format #f "~2,'0d-~a.desktop"
-                                    number (string-downcase name))))
-                  (call-with-output-file file
-                    (lambda (port)
-                      (format port "[Desktop Entry]
-Name=~a
-Exec=~a
-Type=Application~%"
-                              name executable)))
-                  (+ 1 number)))
-              1
-              '#$(map session-type-name sessions)
-              (list #$@(map session-type-executable sessions)))))
-
-  (gexp->derivation "xsessions-dir" builder))
-
 (define %default-slim-theme
   ;; Theme based on work by Felipe López.
   #~(string-append #$%artwork-repository "/slim"))
@@ -264,7 +200,6 @@ Type=Application~%"
                        (theme %default-slim-theme)
                        (theme-name %default-slim-theme-name)
                        (xauth xauth) (dmd dmd) (bash bash)
-                       (sessions %default-xsessions)
                        (auto-login-session #~(string-append #$windowmaker
                                                             "/bin/wmaker"))
                        startx)
@@ -279,17 +214,12 @@ password.  When @var{auto-login?} is true, log in automatically as
 If @var{theme} is @code{#f}, the use the default log-in theme; otherwise
 @var{theme} must be a gexp denoting the name of a directory containing the
 theme to use.  In that case, @var{theme-name} specifies the name of the
-theme.
-
-Last, @var{session} is a list of @code{<session-type>} objects denoting the
-available session types that can be chosen from the log-in screen.  The first
-one is chosen by default."
+theme."
 
   (define (slim.cfg)
     (mlet %store-monad ((startx  (or startx (xorg-start-command)))
                         (xinitrc (xinitrc #:fallback-session
-                                          auto-login-session))
-                        (sessiondir (xsessions-directory sessions)))
+                                          auto-login-session)))
       (text-file* "slim.cfg"  "
 default_path /run/current-system/profile/bin
 default_xserver " startx "
@@ -300,7 +230,7 @@ authfile /var/run/slim.auth
 # The login command.  '%session' is replaced by the chosen session name, one
 # of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
 login_cmd  exec " xinitrc " %session
-sessiondir " sessiondir "
+sessiondir /run/current-system/profile/share/xsessions
 session_msg session (F1 to change):
 
 halt_cmd " dmd "/sbin/halt
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command.
  2015-03-08 14:14 [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir 宋文武
@ 2015-03-08 14:14 ` 宋文武
  2015-03-10  8:48   ` Ludovic Courtès
  2015-03-10  8:46 ` [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: 宋文武 @ 2015-03-08 14:14 UTC (permalink / raw)
  To: guix-devel

* gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
  of COMMAND.  Only run ~/.xsession when it exists.
---
 gnu/services/xorg.scm | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 912cbd3..a6bebf1 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -158,24 +158,23 @@ which should be passed to this script as the first argument.  If not, the
           ;; environment variables that one gets when logging in on a tty, for
           ;; instance.
           (let* ((pw    (getpw (getuid)))
-                 (shell (passwd:shell pw))
-                 (st    (stat command #f)))
-            (when (and st (not (zero? (logand (stat:mode st) #o100))))
-              ;; Close any open file descriptors.  This is all the more
-              ;; important that SLiM itself exec's us directly without closing
-              ;; its own file descriptors!
-              (close-all-fdes)
+                 (shell (passwd:shell pw)))
+            ;; Close any open file descriptors.  This is all the more
+            ;; important that SLiM itself exec's us directly without closing
+            ;; its own file descriptors!
+            (close-all-fdes)
 
-              ;; The '--login' option is supported at least by Bash and zsh.
-              (execl shell shell "--login" "-c"
-                     (string-join (cons command args))))))
+            ;; The '--login' option is supported at least by Bash and zsh.
+            (execl shell shell "--login" "-c"
+                   (string-join (cons command args)))))
 
         (let ((home (getenv "HOME"))
               (session (match (command-line)
                          ((_ x) x)
                          (_     #$fallback-session))))
-          ;; First, try to run ~/.xsession.
-          (exec-from-login-shell (string-append home "/.xsession"))
+          ;; First, try to run ~/.xsession when it exists.
+          (when (file-exists? "~/.xsession")
+            (exec-from-login-shell (string-append home "/.xsession")))
           ;; Then try to start the specified session.
           (exec-from-login-shell session))))
   (gexp->script "xinitrc" builder))
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir.
  2015-03-08 14:14 [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir 宋文武
  2015-03-08 14:14 ` [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command 宋文武
@ 2015-03-10  8:46 ` Ludovic Courtès
  2015-03-10  9:20   ` 宋文武
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-03-10  8:46 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/services/xorg.scm (<session-type>, %windowmaker-session-type)
>   (%ratposion-session-type, %sawfish-session-type, %default-xsessions)
>   (xsessions-directory): Remove.
>   (slim-service): Remove #:sessions parameter.
>   [slim.cfg]: Use /run/current-system/profile/share/xsessions as sessiondir.
> * doc/guix.texi <X Window>: Adjust accordingly.

[...]

> -(define (xsessions-directory sessions)
> -  "Return a directory containing SESSIONS, a list of <session-type> objects.
> -The alphabetical order of the files in that directory match the order of the
> -elements in SESSIONS."

This patch looks like a desirable simplification.  However, we would
lose the ability to specify the order in which sessions are presented to
the user (added in commit a21b23d3.)

Any idea how we could preserve that property?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command.
  2015-03-08 14:14 ` [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command 宋文武
@ 2015-03-10  8:48   ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-03-10  8:48 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> * gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
>   of COMMAND.  Only run ~/.xsession when it exists.

[...]

> +          (when (file-exists? "~/.xsession")
> +            (exec-from-login-shell (string-append home "/.xsession")))

That doesn’t work because ~ won’t get expanded.

What about this:

  (catch 'system-error
    (lambda ()
      ;; First, try to run ~/.xsession.
      (exec-from-login-shell (string-append home "/.xsession")))
    (lambda args
      ;; Then try to start the specified session.
      (exec-from-login-shell session)))

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir.
  2015-03-10  8:46 ` [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir Ludovic Courtès
@ 2015-03-10  9:20   ` 宋文武
  2015-03-12 20:11     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: 宋文武 @ 2015-03-10  9:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

2015-03-10 16:46 GMT+08:00 Ludovic Courtès <ludo@gnu.org>:
> 宋文武 <iyzsong@gmail.com> skribis:
>
>> * gnu/services/xorg.scm (<session-type>, %windowmaker-session-type)
>>   (%ratposion-session-type, %sawfish-session-type, %default-xsessions)
>>   (xsessions-directory): Remove.
>>   (slim-service): Remove #:sessions parameter.
>>   [slim.cfg]: Use /run/current-system/profile/share/xsessions as sessiondir.
>> * doc/guix.texi <X Window>: Adjust accordingly.
>
> [...]
>
>> -(define (xsessions-directory sessions)
>> -  "Return a directory containing SESSIONS, a list of <session-type> objects.
>> -The alphabetical order of the files in that directory match the order of the
>> -elements in SESSIONS."
>
> This patch looks like a desirable simplification.  However, we would
> lose the ability to specify the order in which sessions are presented to
> the user (added in commit a21b23d3.)
>
> Any idea how we could preserve that property?
Have no idea here, since now xsession files are unmodified,
and login managers usually choose the order alphabetical.

But other login managers (eg: lightdm) will remember the lasted
select session.  (If this helps :-)
>
> Thanks,
> Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir.
  2015-03-10  9:20   ` 宋文武
@ 2015-03-12 20:11     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-03-12 20:11 UTC (permalink / raw)
  To: 宋文武; +Cc: Guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> 2015-03-10 16:46 GMT+08:00 Ludovic Courtès <ludo@gnu.org>:
>> 宋文武 <iyzsong@gmail.com> skribis:
>>
>>> * gnu/services/xorg.scm (<session-type>, %windowmaker-session-type)
>>>   (%ratposion-session-type, %sawfish-session-type, %default-xsessions)
>>>   (xsessions-directory): Remove.
>>>   (slim-service): Remove #:sessions parameter.
>>>   [slim.cfg]: Use /run/current-system/profile/share/xsessions as sessiondir.
>>> * doc/guix.texi <X Window>: Adjust accordingly.
>>
>> [...]
>>
>>> -(define (xsessions-directory sessions)
>>> -  "Return a directory containing SESSIONS, a list of <session-type> objects.
>>> -The alphabetical order of the files in that directory match the order of the
>>> -elements in SESSIONS."
>>
>> This patch looks like a desirable simplification.  However, we would
>> lose the ability to specify the order in which sessions are presented to
>> the user (added in commit a21b23d3.)
>>
>> Any idea how we could preserve that property?
> Have no idea here, since now xsession files are unmodified,
> and login managers usually choose the order alphabetical.
>
> But other login managers (eg: lightdm) will remember the lasted
> select session.  (If this helps :-)

OK.  So please push, with the understanding that you’re encouraged to
add lightdm and/or GDM support.  :-)

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-12 20:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-08 14:14 [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir 宋文武
2015-03-08 14:14 ` [PATCH 2/2] services: slim: Allow non-absolute path to be used as session command 宋文武
2015-03-10  8:48   ` Ludovic Courtès
2015-03-10  8:46 ` [PATCH 1/2] services: slim: Use /run/current-system/profile/share/xsessions as sessiondir Ludovic Courtès
2015-03-10  9:20   ` 宋文武
2015-03-12 20:11     ` Ludovic Courtès

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).