Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 439692

Summary: x11-apps/xinit: DESKTOP_SESSION variable empty when using XSESSION with 'startx'
Product: Gentoo Linux Reporter: Rick Harris <rickfharris>
Component: New packagesAssignee: Gentoo X packagers <x11>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: /etc/X11/xinit/xinitrc.d/05-desktop-session

Description Rick Harris 2012-10-25 22:56:53 UTC
Created attachment 327434 [details]
/etc/X11/xinit/xinitrc.d/05-desktop-session

More of an enhancement than a bug, but when using the XSESSION variable to 'startx' in runlevel 3, the resulting X11 session started has an empty $DESKTOP_SESSION environment variable.

This variable is getting depended on more and more to perform other functions from scripts landing in /etc/X11/xinit/xinitrc.d/.

Attached is a xinitrc.d script that sets the DESKTOP_SESSION variable to be the same as ${XSESSION} if it hasn't already been filled by a login manager.

Thoughts ?
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2012-10-26 08:19:59 UTC
(In reply to comment #0)
> Thoughts ?

Upstream Xfce is handling this on it's own within /etc/xdg/xfce4/xinitrc:

# set DESKTOP_SESSION so that one can detect easily if an Xfce session is running
if test "x$DESKTOP_SESSION" = "x"; then
  DESKTOP_SESSION="xfce"
  export DESKTOP_SESSION
fi

I don't have XSESSION set to anything:

$ echo $XSESSION $DESKTOP_SESSION
xfce

Wouldn't this patch feed the wrong value to the DESKTOP_SESSION variable and, ths, cripple the setting done by Xfce itself?
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2012-10-26 08:22:57 UTC
XSESSION can be "Xfce" or "Xfce4" as per:

/etc/X11/Sessions/Xfce4
/etc/X11/Sessions/Xfce

And DESKTOP_SESSION can be "xfce" lowercased. So this patch/improvement wouild indeed feed the wrong value to the DESKTOP_SESSION...
Comment 3 Rick Harris 2012-10-26 23:21:30 UTC
Hmm..yes I see how that's a problem.

Was trying to come up with a global solution but that can't work as all desktops do their own thing for this in subtle ways.

Thanks for replying and sorry for the noise, closing.