Subject: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.

From: Nicolas Graves <[email-masked]>
Date: Fri, 03 Jan 2025 14:23:01 +0100

On 2025-01-02 01:53, muradm wrote:

> This improvement focuses on providing common user session scripts
> for use by multiple greeters. It also fixes incorrect use of
> `XDG_RUNTIME_DIR` for `wlgreet`. `wlgreet` requires compositor to
> run. We provide common sway based greeter script, which can be
> shared by other graphical greeters.

[...]

> +(define (make-greetd-sway-greeter-command sway sway-config)
> +  (let ((sway-bin (file-append sway "/bin/sway")))
> +    (program-file
> +     "greeter-sway-command"
> +     #~(begin
> +         (let* ((username (getenv "USER"))
> +                (useruid (passwd:uid (getpwuid username)))
> +                (useruid (number->string useruid))
> +                ;; /run/user/<greeter-user-uid> won't exist yet
> +                ;; this will contain WAYLAND_DISPLAY socket file
> +                ;; and log-file below
> +                (user-xdg-runtime-dir "/tmp/greeter-xdg-rt")
> +                (log-file (string-append (number->string (getpid)) ".log"))
> +                (log-file (string-append user-xdg-runtime-dir "/"
> log-file)))

Could you explain why this is necessary?  If I'm not mistaken, we didn't
used a special runtime dir in RDE, and it worked OK.

> +           (mkdir user-xdg-runtime-dir #o700)
> +           (setenv "XDG_RUNTIME_DIR" user-xdg-runtime-dir)
> +           (sleep 1) ;; give time to elogind or seatd
> +           (dup2
> +            (open-fdes
> +             log-file
> +             (logior O_CREAT O_WRONLY O_APPEND)
> +             #o640)
> +            1)
> +           (dup2 1 2)

Maybe also here a tiny comment on why this is better than the previous
fileno approach.

> +           (execl #$sway-bin #$sway-bin "-d" "-c" #$sway-config))))))

Also, what about the XDG_CURRENT_DESKTOP setting? Should it not be added
with xdg-env too?

-- 
Best regards,
Nicolas Graves