services: xorg: Make SLiM sessions configurable.
* gnu/services/xorg.scm (%default-xsessions): New variable. (xsessions-directory): New procedure. (slim-service): Add #:sessions and #:auto-login-session parameters. [slim.cfg]: Honor #:sessions. (xinitrc): Adjust accordingly.
This commit is contained in:
parent
9ac97e83e9
commit
24d56899a1
|
@ -36,7 +36,7 @@
|
||||||
#: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-slim-theme
|
%default-slim-theme
|
||||||
%default-slim-theme-name
|
%default-slim-theme-name
|
||||||
slim-service))
|
slim-service))
|
||||||
|
@ -136,9 +136,10 @@ EndSection
|
||||||
|
|
||||||
(define* (xinitrc #:key
|
(define* (xinitrc #:key
|
||||||
(guile (canonical-package guile-2.0))
|
(guile (canonical-package guile-2.0))
|
||||||
(ratpoison ratpoison)
|
fallback-session)
|
||||||
(windowmaker windowmaker))
|
"Return a system-wide xinitrc script that starts the specified X session,
|
||||||
"Return a system-wide xinitrc script that starts the specified X session."
|
which should be passed to this script as the first argument. If not, the
|
||||||
|
@var{fallback-session} will be used."
|
||||||
(define builder
|
(define builder
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (ice-9 match))
|
(use-modules (ice-9 match))
|
||||||
|
@ -155,20 +156,14 @@ EndSection
|
||||||
(execl shell shell "--login" "-c"
|
(execl shell shell "--login" "-c"
|
||||||
(string-join (cons command args))))))
|
(string-join (cons command args))))))
|
||||||
|
|
||||||
;; First, try to run ~/.xsession.
|
(let ((home (getenv "HOME"))
|
||||||
(let* ((home (getenv "HOME"))
|
(session (match (command-line)
|
||||||
(xsession (string-append home "/.xsession")))
|
((_ x) x)
|
||||||
(exec-from-login-shell xsession))
|
(_ #$fallback-session))))
|
||||||
|
;; First, try to run ~/.xsession.
|
||||||
;; Then try a pre-configured session type.
|
(exec-from-login-shell (string-append home "/.xsession"))
|
||||||
(let ((ratpoison (string-append #$ratpoison "/bin/ratpoison"))
|
;; Then try to start the specified session.
|
||||||
(wmaker (string-append #$windowmaker "/bin/wmaker")))
|
(exec-from-login-shell session))))
|
||||||
(match (command-line)
|
|
||||||
((_ "ratpoison")
|
|
||||||
(exec-from-login-shell ratpoison))
|
|
||||||
(_
|
|
||||||
(exec-from-login-shell wmaker))))))
|
|
||||||
|
|
||||||
(gexp->script "xinitrc" builder))
|
(gexp->script "xinitrc" builder))
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,6 +171,35 @@ EndSection
|
||||||
;;; SLiM log-in manager.
|
;;; SLiM log-in manager.
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
|
(define %default-xsessions
|
||||||
|
;; Default xsessions available for log-in manager, representing as a list of
|
||||||
|
;; monadic desktop entries.
|
||||||
|
(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)
|
||||||
|
"Return a directory containing SESSIONS, which should be a list of monadic
|
||||||
|
desktop entries."
|
||||||
|
(mlet %store-monad ((sessions (sequence %store-monad sessions)))
|
||||||
|
(define builder
|
||||||
|
#~(begin
|
||||||
|
(mkdir #$output)
|
||||||
|
(for-each (lambda (session)
|
||||||
|
(symlink session (string-append #$output "/"
|
||||||
|
(basename session))))
|
||||||
|
'#$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.
|
||||||
#~(string-append #$%artwork-repository "/slim"))
|
#~(string-append #$%artwork-repository "/slim"))
|
||||||
|
@ -191,6 +215,9 @@ EndSection
|
||||||
(theme %default-slim-theme)
|
(theme %default-slim-theme)
|
||||||
(theme-name %default-slim-theme-name)
|
(theme-name %default-slim-theme-name)
|
||||||
(xauth xauth) (dmd dmd) (bash bash)
|
(xauth xauth) (dmd dmd) (bash bash)
|
||||||
|
(sessions %default-xsessions)
|
||||||
|
(auto-login-session #~(string-append #$windowmaker
|
||||||
|
"/bin/wmaker"))
|
||||||
startx)
|
startx)
|
||||||
"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
|
||||||
|
@ -198,7 +225,7 @@ turn starts the X display server with @var{startx}, a command as returned by
|
||||||
|
|
||||||
When @var{allow-empty-passwords?} is true, allow logins with an empty
|
When @var{allow-empty-passwords?} is true, allow logins with an empty
|
||||||
password. When @var{auto-login?} is true, log in automatically as
|
password. When @var{auto-login?} is true, log in automatically as
|
||||||
@var{default-user}.
|
@var{default-user} with @var{auto-login-session}.
|
||||||
|
|
||||||
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
|
||||||
|
@ -207,7 +234,9 @@ theme."
|
||||||
|
|
||||||
(define (slim.cfg)
|
(define (slim.cfg)
|
||||||
(mlet %store-monad ((startx (or startx (xorg-start-command)))
|
(mlet %store-monad ((startx (or startx (xorg-start-command)))
|
||||||
(xinitrc (xinitrc)))
|
(xinitrc (xinitrc #:fallback-session
|
||||||
|
auto-login-session))
|
||||||
|
(sessiondir (xsessions-directory sessions)))
|
||||||
(text-file* "slim.cfg" "
|
(text-file* "slim.cfg" "
|
||||||
default_path /run/current-system/profile/bin
|
default_path /run/current-system/profile/bin
|
||||||
default_xserver " startx "
|
default_xserver " startx "
|
||||||
|
@ -218,7 +247,7 @@ authfile /var/run/slim.auth
|
||||||
# The login command. '%session' is replaced by the chosen session name, one
|
# The login command. '%session' is replaced by the chosen session name, one
|
||||||
# of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
|
# of the names specified in the 'sessions' setting: 'wmaker', 'xfce', etc.
|
||||||
login_cmd exec " xinitrc " %session
|
login_cmd exec " xinitrc " %session
|
||||||
sessions wmaker,ratpoison
|
sessiondir " sessiondir "
|
||||||
|
|
||||||
halt_cmd " dmd "/sbin/halt
|
halt_cmd " dmd "/sbin/halt
|
||||||
reboot_cmd " dmd "/sbin/reboot
|
reboot_cmd " dmd "/sbin/reboot
|
||||||
|
|
Loading…
Reference in New Issue