[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: .xinit vs. .xsession summary (was: Re: How to enable larger mouse pointers under X)



On Sat 08 Nov 2014 at 07:16:41 -1000, Joel Roth wrote:

> On Sat, Nov 08, 2014 at 04:17:21PM +0000, Brian wrote:
> > On Sat 08 Nov 2014 at 06:02:00 -1000, Joel Roth wrote:
> > 
> > > Do you have a reference about .xinitrc vs. .xsession?
> > 
> > Lots. :). Fortunately, startx(1) has now been altered to read:
> > 
> >   Note that in the Debian system, what many people traditionally put in the .xini‐
> >   trc file should go in .xsession instead; this permits the same X environment  to
> >   be  presented  whether startx, xdm, or xinit is used to start the X session. All
> >   discussion of the .xinitrc file in the xinit(1) manual page applies equally well
> >   to  .xsession.   Keep  in  mind  that .xinitrc is used only by xinit(1) and com‐
> >   pletely ignored by xdm(1).
>  
> Thanks, that is very helpful.  Now, for the first time, I'm
> looking through the shell scripts in /etc/X11. A lot of
> stuff related to input methods is here.
> 
> > Basically, the files in /etc/X11/Xsession.d are not used with .xinitrc.
> 
> Perhaps this applies to login managers such as xdm, gdm, not
> startx?

No, it applies equally to startx. If there is no ~/.xinitrc (and unless
there are special circumstances there shouldn't be) the system-wide
xinitrc in /etc/X11/xinit is used. Should ~/.xinitrc exist xinitrc is
not used.

A decent example is Xfce on Wheezy. Startx requires co-operation from a
consolekit script in Xsession.d for a user to be able to shutdown the
machine and do other things for which permission is normally required.
With ~/.xinitrc that script isn't sourced.

> According to the comment in /etc/X11/Xsession, which loads
> the runs the scripts in /etc/X11/Xsession.d:
> 
> # global Xsession file -- used by display managers and xinit (startx)
> 
> And /etc/X11/xinit/xinitrc:
> 
> # global xinitrc file, used by all X sessions started by xinit (startx)
> 
> # invoke global X session script
> . /etc/X11/Xsession
> 
> It's not obvious to me what the initial dot '.'
> accomplishes.

'.' means 'source'. It is a bash builtin so 'help source' for its
function. If Xsession is executed instead of sourced it is run in a
sub-shell. When the command terminates the sub-shell disappears and so
do any variables created or modified by the executed script. These
variables (for example, 'USERXSESSION=$HOME/.xsession') remain available
after the script completes when it is sourced.


Reply to: