An question about starting gnome-keyring-daemon in sway profile

Hello. I hope, I’m in right place. If not, please guide me where should I ask this question.

I have pinebook, with swaywm (20.06) installed. I’m trying to understand how the manjaro with sway works. I have a question about a line in an overlay file for sway profile.
Concretely /etc/sway/config.d/99-autostart-applications. There is a line that suppose to start gnome-keyring-daemon.

# enable gnome-keyring daemon
exec systemctl --user import-environment && gnome-keyring-daemon --components=ssh\,secrets\,pkcs11 --start

My question, what is the reasoning for the systemctl --user import-environment? Wrom what I read in manual, it is supposed to import current shell variables into systemd environment. But the gnome-keyring-daemon has in this case nothing to do with systemd. If it was supposed to import the SSH_AUTH_SOCK into systemd environment, then the command is faulty. Or am I missing somethig?

Thank you for your time and looking forward for responses.

Yes, you might be right on this one. Not quite sure about it, but I can remember having difficulties with running the daemon in the beginning. So I looked up some potential solutions to it and found a ticket on the swaywm GH repo showing this line: exec command doesnt escape commas · Issue #4628 · swaywm/sway · GitHub. So I gave it a try and it was working fine. Haven’t looked into the exact details though as I was still busy setting up the rest of the profile…

If you look around the Net you will usually find that ppl start the daemon from some shell or xinit scripts, and then export some env variables. This is not going to work here though.

But you’re right: having the import-environment here doesn’t make sense on a second thought as this is usually required only to import the existing env variables into user-specific systemd units.

Will have a look on it later and adapt the config file accordingly.

Thanks for noting and letting me know!

Cheers,
Andreas

Thanks for your answer @appelgriebsch.

May I ask another one?
Wouldn’t it be sufficient just to add to /etc/profile.d/ a file with

export $(gnome-keyring-daemon --start --components=pkcs11\,secrets\,ssh)

instead of having the 2 calls in /etc/sway/config.d/99-autostart-application and ~/.bashrc?

Not sure about this as wouldn’t this mean to also start the daemon w/o having a logged-in user session?!?

AFAIK are the files in /etc/profile.d also executed when another daemon is started.

In that case I wouldn’t like to have another daemon running that isn’t used as long as no one is signed on…

Ah sorry, my fault. I did mean the ~/.profile. This is where I tested it. I put some logs and I saw, that the ~/.profile gets loaded first (after login, before sway config & .bashrc) and only once. Then I assumed, that if would be in /etc/profile it would work, but I forgot, that it would be executed for every interactive shell, also the root. You’re right on this. So, what about putting the keyring start it into ~/.profile. It wouldn’t be needed to run (and set SSH_AUTH_SOCK) every time you run terminal. Right?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.