I'm running Lubuntu 14.10. It seems that LighDM invokes /etc/X11/Xsession only if directed to so by the user. In fact there is no shadow of it in lightdm-session wrapper.
startxcommand line (wrapper around xinit for reasonable defaults) uses~/.xinitrcif exists, otherwise uses/etc/X11/xinit/xinitrc./etc/X11/xinit/xinitrcsources/etc/X11/Xsession, that redirects output to.xsession-errors./etc/X11/Xsessionsources~/.xsessionrcif exists, then executes~/.xsessionif executable, sources if not.
What happens when using lightdm? If it doesn't source /etc/X11/Xsession, how could it possibly redirect errors to error-file ~/.xsession-errors (I couldn't find any informations on other scripts in /etc/X11/Xsession.d/)?
The man page for Xsession documents ~/.xsessionrc and ~/.xsession. It says that ~/.xsessionrc is only for setting variables and the ~/.xsession is for executing commands, but ~/.xsession gets sourced only if I create a custom *.desktop file in /usr/share/xsessions/ for it. Should I create a custom /etc/X11/Xsession.d/ file (like 40x11-common_xsessionrc works for ~/.xsessionrc), or just use ~/.xsessionrc to add any scripts?
Also, I'd like to know how x-window-manager and x-session-manager work through alternatives. I noticed that they seem to work if no ~/.xinitrc and ~/.xsession exist, and apparently they work only when running startx.
Thanks in advance for any answers.