GNU bug report logs - #75270
[PATCH 0/3] services: greetd: Improve greeter configurations.

Previous Next

Package: guix-patches;

Reported by: muradm <mail <at> muradm.net>

Date: Wed, 1 Jan 2025 22:49:02 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: muradm <mail <at> muradm.net>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 75270 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
Date: Fri, 03 Jan 2025 20:08:42 +0300
[Message part 1 (text/plain, inline)]
Nicolas Graves <ngraves <at> ngraves.fr> writes:

> 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.
>

When you start sway, it has to put WAYLAND_DISPLAY somewhere. By 
default it is put to `/run/user/<uid>`. However greeter is special 
limited user which is used to run without logging in. Because of 
that, `/run/user/<uid>` is not created by PAM mount. For special 
purpose we can use any XDG_RUNTIME_DIR. Sway does not support 
specifying location of WAYLAND_DISPLAY as far as I remember (I was 
opening an issue about it long ago, still was not resolved).

>> +           (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.
>

dup2 takes file descriptor, open-fdes provides in one go. 
Otherwise technically it does not matter how you acquire file 
descriptor. This script I created long ago for greeters. This is 
my recent version.

>> +           (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?

You don't need it, to run single sway process with single greeter 
application. Keep in mind that there is an "environment" to run 
greeter, and another "envrionment" for user after the login. They 
do not overlap. If you need XDG_CURRENT_DESKTOP for user after 
login, it could be set by window manager, desktop environment, 
manually in profile or manually in `extra-env` of 
`greetd-user-session`.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.