%default-slim-theme
%default-slim-theme-name
+
slim-configuration
+ slim-configuration?
+ slim-configuration-slim
+ slim-configuration-allow-empty-passwords?
+ slim-configuration-auto-login?
+ slim-configuration-default-user
+ slim-configuration-theme
+ slim-configuration-theme-name
+ slim-configuration-xauth
+ slim-configuration-shepherd
+ slim-configuration-auto-login-session
+ slim-configuration-startx
+
slim-service-type
slim-service
(file-append font-alias "/share/fonts/X11/100dpi")
(file-append font-alias "/share/fonts/X11/misc")
(file-append font-alias "/share/fonts/X11/cyrillic")
+ (file-append font-misc-misc ;default fonts for xterm
+ "/share/fonts/X11/misc")
(file-append font-adobe75dpi "/share/fonts/X11/75dpi")))
(define* (xorg-configuration-file #:key
fallback-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."
+@var{fallback-session} will be used or, if @var{fallback-session} is false, a
+desktop session from the system or user profile will be used."
(define builder
#~(begin
- (use-modules (ice-9 match))
+ (use-modules (ice-9 match)
+ (ice-9 regex)
+ (ice-9 ftw)
+ (ice-9 rdelim)
+ (srfi srfi-1)
+ (srfi srfi-26))
(define (close-all-fdes)
;; Close all the open file descriptors except 0 to 2.
(execl shell shell "--login" "-c"
(string-join (cons command args)))))
+ (define system-profile
+ "/run/current-system/profile")
+
+ (define user-profile
+ (and=> (getpw (getuid))
+ (lambda (pw)
+ (string-append (passwd:dir pw) "/.guix-profile"))))
+
+ (define (xsession-command desktop-file)
+ ;; Read from DESKTOP-FILE its X session command and return it as a
+ ;; list.
+ (define exec-regexp
+ (make-regexp "^[[:blank:]]*Exec=(.*)$"))
+
+ (call-with-input-file desktop-file
+ (lambda (port)
+ (let loop ()
+ (match (read-line port)
+ ((? eof-object?) #f)
+ ((= (cut regexp-exec exec-regexp <>) result)
+ (if result
+ (string-tokenize (match:substring result 1))
+ (loop))))))))
+
+ (define (find-session profile)
+ ;; Return an X session command from PROFILE or #f if none was found.
+ (let ((directory (string-append profile "/share/xsessions")))
+ (match (scandir directory
+ (cut string-suffix? ".desktop" <>))
+ ((or () #f)
+ #f)
+ ((sessions ...)
+ (any xsession-command
+ (map (cut string-append directory "/" <>)
+ sessions))))))
+
(let* ((home (getenv "HOME"))
(xsession-file (string-append home "/.xsession"))
(session (match (command-line)
- ((_) (list #$fallback-session))
- ((_ x ..1) x))))
+ ((_)
+ #$(if fallback-session
+ #~(list #$fallback-session)
+ #f))
+ ((_ x ..1)
+ x))))
(if (file-exists? xsession-file)
;; Run ~/.xsession when it exists.
- (apply exec-from-login-shell xsession-file session)
- ;; Otherwise, start the specified session.
- (apply exec-from-login-shell session)))))
+ (apply exec-from-login-shell xsession-file
+ (or session '()))
+ ;; Otherwise, start the specified session or a fallback.
+ (apply exec-from-login-shell
+ (or session
+ (find-session user-profile)
+ (find-session system-profile)))))))
(program-file "xinitrc" builder))
slim-configuration?
(slim slim-configuration-slim
(default slim))
- (allow-empty-passwords? slim-configuration-allow-empty-passwords?)
- (auto-login? slim-configuration-auto-login?)
- (default-user slim-configuration-default-user)
- (theme slim-configuration-theme)
- (theme-name slim-configuration-theme-name)
+ (allow-empty-passwords? slim-configuration-allow-empty-passwords?
+ (default #t))
+ (auto-login? slim-configuration-auto-login?
+ (default #f))
+ (default-user slim-configuration-default-user
+ (default ""))
+ (theme slim-configuration-theme
+ (default %default-slim-theme))
+ (theme-name slim-configuration-theme-name
+ (default %default-slim-theme-name))
(xauth slim-configuration-xauth
(default xauth))
(shepherd slim-configuration-shepherd
(default shepherd))
- (auto-login-session slim-configuration-auto-login-session)
- (startx slim-configuration-startx))
+ (auto-login-session slim-configuration-auto-login-session
+ (default #f))
+ (startx slim-configuration-startx
+ (default (xorg-start-command)))
+ (sessreg slim-configuration-sessreg
+ (default sessreg)))
(define (slim-pam-service config)
"Return a PAM service for @command{slim}."
(xauth (slim-configuration-xauth config))
(startx (slim-configuration-startx config))
(shepherd (slim-configuration-shepherd config))
- (theme-name (slim-configuration-theme-name config)))
+ (theme-name (slim-configuration-theme-name config))
+ (sessreg (slim-configuration-sessreg config)))
(mixed-text-file "slim.cfg" "
default_path /run/current-system/profile/bin
default_xserver " startx "
login_cmd exec " xinitrc " %session
sessiondir /run/current-system/profile/share/xsessions
session_msg session (F1 to change):
+sessionstart_cmd " sessreg "/bin/sessreg -a -l $DISPLAY %user
+sessionstop_cmd " sessreg "/bin/sessreg -d -l $DISPLAY %user
halt_cmd " shepherd "/sbin/halt
reboot_cmd " shepherd "/sbin/reboot\n"
;; Unconditionally add xterm to the system profile, to
;; avoid bad surprises.
(service-extension profile-service-type
- (const (list xterm)))))))
+ (const (list xterm)))))
+ (default-value (slim-configuration))))
-(define* (slim-service #:key (slim slim)
+(define* (slim-service #:key (slim slim) ;deprecated
(allow-empty-passwords? #t) auto-login?
(default-user "")
(theme %default-slim-theme)
(theme-name %default-slim-theme-name)
(xauth xauth) (shepherd shepherd)
- (auto-login-session (file-append windowmaker
- "/bin/wmaker"))
+ (auto-login-session #f)
(startx (xorg-start-command)))
"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
#:optional
(program (package-name package))
#:key allow-empty-passwords?)
- "Add @var{package}, a package for a screen-locker or screen-saver whose
+ "Add @var{package}, a package for a screen locker or screen saver whose
command is @var{program}, to the set of setuid programs and add a PAM entry
for it. For example: