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

Re: customize Debian 11 evironment in lightdm (and in general?)



On Fri, 6 May 2022 at 09:34, Greg Wooledge <greg@wooledge.org> wrote:
> On Fri, May 06, 2022 at 09:16:09AM +1000, David wrote:

Hi, thanks for your comments.

> > So it appears that . ~/.profile runs when Xsession starts,
> > but ~/.bashrc is not run until I manually open a terminal
> > in LXDE, which appears in the above as x-terminal-emul.
>
> Your .profile should be written to dot in ~/.bashrc if it's being run
> by bash.  E.g. something like:
>
> test "$BASH_VERSION" && test -r ~/.bashrc && . ~/.bashrc

Yeah, I have this, to handle other shells apart from bash:

# user environment
if [ -n "${BASH_VERSION}" ] ; then
    #: this login is bash, include .bashrc
    f="${HOME}/.bashrc"
else
    #: this login not bash, include _my_export
    f="${HOME}/bin/_my_export"
fi
if [ -r "${f}" ] ; then
    . "${f}"
fi
unset f

My ~/.bashrc uses the same _my_export to set and export
environment variables.

> In the absence of this, you will not have the desired shell environment
> if you ever use a login shell -- e.g. if you hit Ctrl-Alt-F2 and login
> on a console, or if you ssh into the system.
>
> If you never do either of these things, well, you're fine.

I do all those things, and they work.

> > I assume that Xsession and lxsession are the same process
> > because they have the same PID.
>
> In a proper universe, the former would exec (chain-load) the latter.

Maybe that's what Xsession does, I can't recall.

> > I have chosen to use lxterminal to provide x-terminal-emul.
> > One quirk of lxterminal is that there is only one process
> > which handles all open terminal windows.
>
> Sounds atrocious.

Well, I mentioned it for a reason :)

> If you ever feel bored, you could run this experiment, and see what
> happens:
>
> 1) Put "umask 002" in your ~/.xsessionrc file.
>
> 2) Log out and back in.
>
> 3) Open an lxterminal.
>
> 4) Type "umask" and see what it's set to.
>
> If my conclusions from the OP's post are correct, it will report 0022,
> the Debian system default, totally ignoring your attempt to customize it.

I'm not using the Debian default. I use ~/bin/_my_export to set umask,
and it works. I don't have time to experiment with that for this thread.

> Less invasively, a process tree showing the ancestry of a shell running
> inside an lxterminal would be helpful.  Something like this:
>
> unicorn:~$ pstree -s $$
> systemd───login───bash───startx───xinit───.xsession───rxvt───bash───pstree

Inside lxterminal:
[david@kablamm ~]$ pstree -s $$
systemd───lightdm───lightdm───lxsession───lxpanel───x-terminal-emul───bash───pstree

which is consistent with my homemade trace posted in previous message:
  lightdm(1310) > lightdm(1393) > lxsession(1414) > lxpanel(1503) >
x-terminal-emul(2403) > bash(2433) . ~/.bashrc

I believe that what I have implemented also works using startx when
lightdm is not installed, but I'm not going to test that for this thread,
I have other things to do, and this lives in the bucket of things
I figured out long ago, and luckily it meets all my needs that I'm aware
of, so I forgot all about it :)


Reply to: