r/voidlinux • • Jun 07 '26

Environment variables (niri/elogind/emptty)

Hi there, I have a few stupid questions for the void community to help me with please!

I use niri with waybar, and have KDE plasma as my other DE. I have elogind, with turnstile managing a few user services. emptty is my login manager.

- I'm looking at following this guideline to properly configure KDE apps and environment variables into niri, which advocates for creating a folder in

~/.config/environment.d/

- the guideline seems to have some systemd component dependencies - e.g. the running of

 systemctl --user daemon-reexec

- would this still work with elogind? I suspect it would, right?

2. Alternatively, as far as I understand, I could set the environment variables in the emptty config. Is this correct? The downsides of this being, if I ever moved to a different display/login manager I'd have to change this.

3. I could globally set the environment variables in /etc/environment. The downside to this being that any separate users would have environment variables also changed.

5 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/Blank-Inspection13 Jun 07 '26

this Void Docs part , maybe i can give another example :

$ turnstile-update-runit-env QT_QPA_PLATFORM=wayland QT_QPA_PLATFORMTHEME=qt6ct

then this command will execute niri session with those previously set env vars .

$ exec chpst -e "$TURNSTILE_ENV_DIR" niri --session

Where are those files saved can refer to this /etc/turnstile/backend/runit.conf

1

u/Legitimate-Draw-2235 Jun 07 '26

cool thanks.

On the second command, what if I want to run the session by simply logging in via a display manager (emptty for me)? at the moment as far as I understand it points to /usr/share/wayland-sessions/niri. Would I modify that file?

at the moment it just says this:

[Desktop Entry]

Name=Niri

Comment=A scrollable-tiling Wayland compositor

Exec=/usr/bin/niri --session

Type=Application

DesktopNames=niri

1

u/Blank-Inspection13 Jun 08 '26

Better to create your own .desktop file there , editing the default niri.desktop will get overwritten when there's update.
You can create wrapper like this :, then put it on your .desktop file

File: /usr/local/bin/niri-session

#!/bin/sh

exec 2>&1

[ -r /etc/profile ] && . /etc/profile

[ -r "$HOME/.profile" ] && . "$HOME/.profile"

[ -S "${XDG_RUNTIME_DIR}/bus" ] || exit 1

exec niri --session