services: xorg: Run the window manager from a login shell.
This is a followup to 1d18d87
, which fixes <http://bugs.gnu.org/19119>.
* gnu/services/xorg.scm (xinitrc)[builder]: Add 'exec-from-login-shell'
procedure. Use it instead of 'execl' when launching XSESSION, WMAKER,
or RATPOISON.
This commit is contained in:
parent
a8a086e392
commit
b2bd7c253a
|
@ -143,28 +143,31 @@ EndSection
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (ice-9 match))
|
(use-modules (ice-9 match))
|
||||||
|
|
||||||
(let* ((home (getenv "HOME"))
|
(define (exec-from-login-shell command . args)
|
||||||
(profile (string-append home "/.guix-profile/bin"))
|
;; Run COMMAND from a login shell so that it gets to see the same
|
||||||
(PATH (or (getenv "PATH") ""))
|
;; environment variables that one gets when logging in on a tty, for
|
||||||
(xsession (string-append home "/.xsession")))
|
;; instance.
|
||||||
;; Make sure the user's profile is visible.
|
(let* ((pw (getpw (getuid)))
|
||||||
(setenv "PATH"
|
(shell (passwd:shell pw))
|
||||||
(string-append profile
|
(st (stat command #f)))
|
||||||
(if (string-null? PATH) "" ":")
|
(when (and st (not (zero? (logand (stat:mode st) #o100))))
|
||||||
PATH))
|
;; The '--login' option is supported at least by Bash and zsh.
|
||||||
|
(execl shell shell "--login" "-c"
|
||||||
|
(string-join (cons command args))))))
|
||||||
|
|
||||||
;; First, try to run ~/.xsession.
|
;; First, try to run ~/.xsession.
|
||||||
(false-if-exception (execl xsession xsession)))
|
(let* ((home (getenv "HOME"))
|
||||||
|
(xsession (string-append home "/.xsession")))
|
||||||
|
(exec-from-login-shell xsession))
|
||||||
|
|
||||||
;; Then try a pre-configured session type.
|
;; Then try a pre-configured session type.
|
||||||
(let ((ratpoison (string-append #$ratpoison "/bin/ratpoison"))
|
(let ((ratpoison (string-append #$ratpoison "/bin/ratpoison"))
|
||||||
(wmaker (string-append #$windowmaker "/bin/wmaker")))
|
(wmaker (string-append #$windowmaker "/bin/wmaker")))
|
||||||
(match (command-line)
|
(match (command-line)
|
||||||
((_ "ratpoison")
|
((_ "ratpoison")
|
||||||
(execl ratpoison ratpoison))
|
(exec-from-login-shell ratpoison))
|
||||||
(_
|
(_
|
||||||
;; 'wmaker' does execvp(argv[0]), so we really can't mess up.
|
(exec-from-login-shell wmaker))))))
|
||||||
(execl wmaker wmaker))))))
|
|
||||||
|
|
||||||
(gexp->script "xinitrc" builder))
|
(gexp->script "xinitrc" builder))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue