-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Another run at #6 .
Would you consider modifying session.sh so that it looks for an "Environment" file in a pre-defined location, and, if the file exists, sources the variables in that file and then adds them to the $VARIABLES list alongside the default variables hardcoded in the script and those passed in via -E?
This has the advantage of leveraging a broadly-used format (i.e, you can crib from people using .profile or /etc/environment.d). It also should mean that the file won't get overwritten when sway-systemd is upgraded (unlike changes to -E in 10-systemd-session.conf).
I stuck this language into my session.sh and, while it's not pretty it does seem to work:
set_var(){
. ${1}
while read -r line; do
if [[ $(echo $line | grep -v ^#) ]]; then
line=${line%=*}
export ${line}
VARIABLES="${VARIABLES} ${line}"
fi
done < ${1}
}
if [[ -e ~/.config/sway-systemd/env ]]; then
set_var ~/.config/sway-systemd/env
fi
Similarly, would it be possible to do something similar for the transient scope units created by assign-cgroups.py? It seems one could parse an Environment file and submit the name/value pairs via the systemd d-bus API's SetEnvironment() method. Since a lot of the commonly-used environment variables are used to persuade GUI programs to use wayland, this might prove useful.