Web lists-archives.com

Re: Whats the alternative to .xinitrc




On 2017-02-20 08:19:28 -0500, Greg Wooledge wrote:
> OK, short version: forget .xinitrc ever existed.

*And* make sure that you do not have a .xinitrc file, otherwise it
can break things (at least when logging in on a text console).

> Use ~/.xsession unless that doesn't work. See
> https://wiki.debian.org/Xsession
> 
> Long version:
> 
> You can either log in on a text console and run startx to start X,
> or you can login through a GUI display manager.  Of which there are
> a whole bunch.
> 
> Either way, Debian reads ~/.xsessionrc first.  You should use that to set
> variables like PATH in the X environment, since display manager logins
> don't read your shell dot files.  Don't use .xsessionrc to start window
> managers or desktop environments, though.
> 
> If you use startx, then AFTER .xsessionrc, Debian will read the
> ~/.xsession file.  Use that to start your X client programs and then
> to exec your window manager.
> 
> If you use a display manager, then .xsession may or may not be used.
> Who knows.

You can see .xsession as a wrapper to a window manager. Depending on
the current configuration, the DM can either execute a window manager
directly or execute .xsession instead. The choice is done via:

  /etc/X11/Xsession.d/20x11-common_process-args

or

  /etc/X11/Xsession.d/50x11-common_determine-startup

More precisely, if I understand correctly,

1. The DM can request some window manager (for instance, the user has
   the choice between several ones, and he may also choose the default
   session file, or whatever has been used last). If a choice has been
   done, then /etc/X11/Xsession.d/20x11-common_process-args will define
   $STARTUP based on this choice.

2. If there wasn't a specific request, then when
   /etc/X11/Xsession.d/50x11-common_determine-startup is sourced,
   $STARTUP is still empty. In this case, $STARTUP is defined there
   in the following way.

2a. If /etc/X11/Xsession.options contains allow-user-xsession (which
    isn't the default, AFAIK), then $STARTUP is set to the user
    session file, normally "$HOME/.xsession", as /etc/X11/Xsession
    contains: USERXSESSION=$HOME/.xsession
    The window manager should be started from this script.

2b. Otherwise, the following executables are tried in succession:
      /usr/bin/x-session-manager
      /usr/bin/x-window-manager
      /usr/bin/x-terminal-emulator

Other configuration files from /etc/X11/Xsession.d may modify $STARTUP.
For instance, with gtk3-nocsd installed,
/etc/X11/Xsession.d/70gtk3-nocsd-propagate-LD_PRELOAD does:

  STARTUP="env LD_PRELOAD=$LD_PRELOAD $STARTUP"

Finally, /etc/X11/Xsession.d/99x11-common_start does:

exec $STARTUP

Note: since window managers can also start X clients on start up,
a .xsession file may not be useful for everyone.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)