# guixrus/services/greetd.scm -rw-r--r-- 1.5 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;; ---8<--- snip snip snip ---8<---

(define make-wlgreet-configuration-file
  (match-lambda
    (($ <greetd-wlgreet-session> _ config-file-name command command-args
        output-mode scale background headline prompt prompt-error border)
     (mixed-text-file config-file-name
       "command = \"" (string-join (cons command command-args) " ") "\"\n"
       "outputMode = \"" output-mode "\"\n"
       "scale = \"" (number->string scale) "\"\n"
       (apply string-append
              (map (match-lambda
                    ((section-name . color)
                     (make-wlgreet-config-color section-name color)))
                   `(("background" . ,background)
                     ("headline" . ,headline)
                     ("prompt" . ,prompt)
                     ("prompt-error" . ,prompt-error)
                     ("border" . ,border))))))))

(define greetd-wlgreet-xdg-session-command
  (match-lambda
    (($ <greetd-wlgreet-session> wlgreet config-file-name)
     (let ((config #|get the path of make-wlgreet-configuration-file somehow|#))
       (program-file "wlgreet-xdg-session-command"
         #~(begin
             (use-modules (ice-9 match))
             (let* ((username (getenv "USER"))
                    (useruid (number->string
                              (passwd:uid (getpwuid username)))))
               (setenv "XDG_SESSION_TYPE" ""))
             (for-each (match-lambda ((name . val) (setenv name val)))
                       extra-env)
             (execl #$wlgreet #$wlgreet "--config" #$config)))))))