coastalwhite / lemurs

A customizable TUI display/login manager written in Rust 🐒
Apache License 2.0
756 stars 34 forks source link

Same enviroment variable for all lemur environments #215

Open diggit opened 2 weeks ago

diggit commented 2 weeks ago

Hi, is there a way how to ensure all lemur environments get same additional environment variables?

My idea is to use systemd env generator /usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator (which combines all *.conf files from ~/.config/environment.d/ into stdout) and provide this environment to all.

for sway example it could be done this way:

#! /bin/sh
set -a
eval $(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
set +a
exec sway

but how to achieve same thing for TTY shell enabled by include_tty_shell = true ?

Maybe related to #196. Custom "tty sessions" could be then just wrapped also into the script like sway above.

diggit commented 2 weeks ago

Hmm, one option could be to exec sway from user shell and assume the user shell handles initialization of all environment variables:

#! /bin/sh
exec $SHELL -c "exec sway"

tty shell lemurs environment just launches user shell, so same env. variables there.

I am curious if there is a better way...