Verified Commit a7b0eaf3 authored by clayton craft's avatar clayton craft 🕺🏽 Committed by Oliver Smith
Browse files

Add support for sourcing env profiles based on session type (MR 9)

This adds the ability to source any files under
/etc/tinydm.d/$session_type.d, where session_type is either x11 or
wayland. The intention is to allow users to specify variables that
should only be set for specific session types and not others, e.g.
`MOZ_ENABLE_WAYLAND=1` or `SDL_VIDEODRIVER=wayland`.
parent dd2e720a
Pipeline #320889466 passed with stage
in 12 seconds
......@@ -18,3 +18,6 @@ install:
install -Dm644 tinydm.confd \
"$(DESTDIR)/etc/conf.d/tinydm"; \
fi
mkdir -p $(DESTDIR)/etc/tinydm.d/env-wayland.d
mkdir -p $(DESTDIR)/etc/tinydm.d/env-x11.d
......@@ -4,3 +4,6 @@ Tiny wayland / x11 session starter for single user machines
More information:
https://gitlab.com/postmarketOS/pmaports/-/issues/823
Environment can be configured for both X11 and Wayland sessions by adding files
to source on startup to `/etc/tinydm.d/env-x11.d` and `/etc/tinydm.d/env-wayland.d`
......@@ -22,6 +22,24 @@ source_profile() {
done
}
# $1: session type (i.e. 'wayland', or 'x11')
source_session_profiles() {
session_type="$1"
if [ "$session_type" != "wayland" ] && [ "$session_type" != "x11" ]; then
echo "Unknown session type: $session_type"
exit 1
fi
[ ! -d "/etc/tinydm.d/env-${session_type}.d" ] && return
for file in "/etc/tinydm.d/env-${session_type}.d/"*; do
echo "tinydm: sourcing file: $file"
# shellcheck disable=SC1090
. "$file"
done
}
# $1: file
# $2: key
parse_xdg_desktop() {
......@@ -72,10 +90,12 @@ run_session() {
case "$resolved" in
/usr/share/wayland-sessions*)
source_session_profiles wayland
# shellcheck disable=SC2086
run_session_wayland $cmd
;;
/usr/share/xsessions*)
source_session_profiles x11
# shellcheck disable=SC2086
run_session_x $cmd
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment