services: xorg: Define the <session-type> record type.
* gnu/services/xorg.scm (<session-type>): New record type. (%windowmaker-session-type, %ratpoison-session-type): New variables. (%default-xsessions): Use them. (xsessions-directory): Expect SESSIONS to be a list of <session-type> and rewrite accordingly. (slim-service): Adjust docstring. * doc/guix.texi (X Window): Update accordingly.
This commit is contained in:
parent
3bcfe23cfc
commit
ffc3a02b5a
2 changed files with 64 additions and 27 deletions
|
|
@ -4531,7 +4531,8 @@ started by the @dfn{login manager}, currently SLiM.
|
||||||
@deffn {Monadic Procedure} slim-service [#:allow-empty-passwords? #f] @
|
@deffn {Monadic Procedure} slim-service [#:allow-empty-passwords? #f] @
|
||||||
[#:auto-login? #f] [#:default-user ""] [#:startx] @
|
[#:auto-login? #f] [#:default-user ""] [#:startx] @
|
||||||
[#:theme @var{%default-slim-theme}] @
|
[#:theme @var{%default-slim-theme}] @
|
||||||
[#:theme-name @var{%default-slim-theme-name}]
|
[#:theme-name @var{%default-slim-theme-name}] @
|
||||||
|
[#:sessions @var{%default-sessions}]
|
||||||
Return a service that spawns the SLiM graphical login manager, which in
|
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
|
turn starts the X display server with @var{startx}, a command as returned by
|
||||||
@code{xorg-start-command}.
|
@code{xorg-start-command}.
|
||||||
|
|
@ -4544,8 +4545,23 @@ 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
|
@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 to use. In that case, @var{theme-name} specifies the name of the
|
||||||
theme.
|
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.
|
||||||
@end deffn
|
@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} %default-theme
|
@defvr {Scheme Variable} %default-theme
|
||||||
@defvrx {Scheme Variable} %default-theme-name
|
@defvrx {Scheme Variable} %default-theme-name
|
||||||
The G-Expression denoting the default SLiM theme and its name.
|
The G-Expression denoting the default SLiM theme and its name.
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,18 @@
|
||||||
#:use-module (guix store)
|
#:use-module (guix store)
|
||||||
#:use-module (guix monads)
|
#:use-module (guix monads)
|
||||||
#:use-module (guix derivations)
|
#:use-module (guix derivations)
|
||||||
|
#:use-module (guix records)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:export (xorg-start-command
|
#:export (xorg-start-command
|
||||||
%default-xsessions
|
%default-xsessions
|
||||||
|
%ratpoison-session-type
|
||||||
|
%windowmaker-session-type
|
||||||
|
|
||||||
|
session-type?
|
||||||
|
session-type-name
|
||||||
|
|
||||||
%default-slim-theme
|
%default-slim-theme
|
||||||
%default-slim-theme-name
|
%default-slim-theme-name
|
||||||
slim-service))
|
slim-service))
|
||||||
|
|
@ -172,34 +179,45 @@ which should be passed to this script as the first argument. If not, the
|
||||||
;;; SLiM log-in manager.
|
;;; 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 %default-xsessions
|
(define %default-xsessions
|
||||||
;; Default xsessions available for log-in manager, representing as a list of
|
;; Default session types available to the log-in manager.
|
||||||
;; monadic desktop entries.
|
(list %windowmaker-session-type %ratpoison-session-type))
|
||||||
(list (text-file* "wmaker.desktop" "
|
|
||||||
[Desktop Entry]
|
|
||||||
Name=Window Maker
|
|
||||||
Exec=" windowmaker "/bin/wmaker
|
|
||||||
Type=Application
|
|
||||||
")
|
|
||||||
(text-file* "ratpoison.desktop" "
|
|
||||||
[Desktop Entry]
|
|
||||||
Name=Ratpoison
|
|
||||||
Exec=" ratpoison "/bin/ratpoison
|
|
||||||
Type=Application
|
|
||||||
")))
|
|
||||||
|
|
||||||
(define (xsessions-directory sessions)
|
(define (xsessions-directory sessions)
|
||||||
"Return a directory containing SESSIONS, which should be a list of monadic
|
"Return a directory containing SESSIONS, a list of <session-type> objects."
|
||||||
desktop entries."
|
(define builder
|
||||||
(mlet %store-monad ((sessions (sequence %store-monad sessions)))
|
#~(begin
|
||||||
(define builder
|
(mkdir #$output)
|
||||||
#~(begin
|
(chdir #$output)
|
||||||
(mkdir #$output)
|
(for-each (lambda (name executable)
|
||||||
(for-each (lambda (session)
|
(let ((file (string-append (string-downcase name)
|
||||||
(symlink session (string-append #$output "/"
|
".desktop")))
|
||||||
(basename session))))
|
(call-with-output-file file
|
||||||
'#$sessions)))
|
(lambda (port)
|
||||||
(gexp->derivation "xsessions-dir" builder)))
|
(format port "[Desktop Entry]
|
||||||
|
Name=~a
|
||||||
|
Exec=~a
|
||||||
|
Type=Application~%"
|
||||||
|
name executable)))))
|
||||||
|
'#$(map session-type-name sessions)
|
||||||
|
(list #$@(map session-type-executable sessions)))))
|
||||||
|
|
||||||
|
(gexp->derivation "xsessions-dir" builder))
|
||||||
|
|
||||||
(define %default-slim-theme
|
(define %default-slim-theme
|
||||||
;; Theme based on work by Felipe López.
|
;; Theme based on work by Felipe López.
|
||||||
|
|
@ -231,7 +249,10 @@ 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
|
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
|
@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 to use. In that case, @var{theme-name} specifies the name of the
|
||||||
theme."
|
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."
|
||||||
|
|
||||||
(define (slim.cfg)
|
(define (slim.cfg)
|
||||||
(mlet %store-monad ((startx (or startx (xorg-start-command)))
|
(mlet %store-monad ((startx (or startx (xorg-start-command)))
|
||||||
|
|
|
||||||
Reference in a new issue