[LightDM] How to give desktop-initiated apps same environment as is specified in shell init files?
Kynn Jones
kynnjo at gmail.com
Mon Jan 18 07:15:52 PST 2016
The subject line pretty much says it all.
I have found online an assortment of hacks for doing this sort of
thing, but they are, well, hacks. IOW, they have little to do with
the DM's API.
Since according to [this StackOverflow
answer](http://stackoverflow.com/a/9441513/559827) the question I'm
asking here is one that "dates back to the first `xdm' Xsession
scripts", I am hoping that by now there are at least some more or less
"standard" approaches to this problem, if not by design then at least
by "tradition".
FWIW, I have found a *totally unmaintainable and non-portable* hack of
my own. It consists of an ~/.xsession script that ends with the line
exec "$SHELL" -lc "exec $STARTUP"
The lines before this last line are all about setting the STARTUP
variable. They consist of snippets cannibalized verbatim from various
/etc/X11/Xsession* scripts (this is what makes the ~/.xsession script
unmaintanable and non-portable). I show the full ~/.xsession script
below, for the sake of clarity and explicitness. Even though it is
*completely unsound*, at least it has the virtue of spelling out
unambiguously what my ultimate goal is.
Also FWIW, my distro is Debian (8.2 jessie).
Thanks in advance!
kj
WARNING: I DO NOT recommend the ~/.xsession script below; it is very
specific to one particular state of one particular machine; please do
not use it!
#!/bin/sh
# ------------------------------------------------------------------------------
# from /etc/X11/Xsession
OPTIONFILE=/etc/X11/Xsession.options
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# from /etc/X11/Xsession.d/20x11-common_process-args
OPTIONS=$(cat "$OPTIONFILE") || true
has_option() {
if [ "${OPTIONS#*
$1}" != "$OPTIONS" ]; then
return 0
else
return 1
fi
}
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# from /etc/X11/Xsession.d/50x11-common_determine-startup
if [ -x /usr/bin/x-session-manager ]; then
STARTUP=x-session-manager
elif [ -x /usr/bin/x-window-manager ]; then
STARTUP=x-window-manager
elif [ -x /usr/bin/x-terminal-emulator ]; then
STARTUP=x-terminal-emulator
fi
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# from /etc/X11/Xsession.d/75dbus_dbus-launch
STARTDBUS=
DBUSLAUNCH=/usr/bin/dbus-launch
if has_option use-session-dbus; then
if [ -x "$DBUSLAUNCH" ]; then
STARTDBUS=yes
fi
fi
if [ -n "$STARTDBUS" ]; then
STARTUP="$DBUSLAUNCH --exit-with-session $STARTUP"
fi
# ------------------------------------------------------------------------------
exec "$SHELL" -lc "exec $STARTUP"
More information about the LightDM
mailing list