Merge pull request #2522 from akarl10/startwm-xsession-desktop-files

Debian: use startup command from /usr/share/xsession if DISPLAY_SESSION is set
This commit is contained in:
matt335672 2023-02-02 14:21:51 +00:00 committed by GitHub
commit 04a9c76087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,20 @@ post_start()
return 0 return 0
} }
get_xdg_session_startupcmd()
{
# DESKTOP_SESSION should be set in sesman.ini in the SessionVariables section.
# If set and valid then the STARTUP command will be taken from there
if [ -n "$1" ] && [ -d /usr/share/xsessions ] \
&& [ -f "/usr/share/xsessions/$1.desktop" ]; then
STARTUP=$(grep ^Exec= "/usr/share/xsessions/$1.desktop")
STARTUP=${STARTUP#Exec=*}
XDG_CURRENT_DESKTOP=$(grep ^DesktopNames= "/usr/share/xsessions/$1.desktop")
XDG_CURRENT_DESKTOP=${XDG_CURRENT_DESKTOP#DesktopNames=*}
echo "env XDG_CURRENT_DESKTOP=\"$XDG_CURRENT_DESKTOP\" $STARTUP"
fi
}
#start the window manager #start the window manager
wm_start() wm_start()
{ {
@ -66,6 +80,15 @@ wm_start()
# debian # debian
if [ -r /etc/X11/Xsession ]; then if [ -r /etc/X11/Xsession ]; then
pre_start pre_start
# STARTUP is the default startup command.
# if $1 is empty and STARTUP was not set
# /etc/X11/Xsession.d/50x11-common_determine-startup will fallback to
# x-session-manager
if [ -z "$STARTUP" ] && [ -n "$DESKTOP_SESSION" ]; then
STARTUP="$(get_xdg_session_startupcmd "$DESKTOP_SESSION")"
fi
. /etc/X11/Xsession . /etc/X11/Xsession
post_start post_start
exit 0 exit 0