On Fri, 6 May 2022 at 04:24, Greg Wooledge <g...@wooledge.org> wrote: > On Thu, May 05, 2022 at 06:48:49PM +0200, Giovanni Biscuolo wrote:
> > I'm trying to customize my user environment when using the lightdm > > display manager (then the LXDE desktop environment) Hello TLDR: try defining the variables you need in ~/.xsessionrc I don't have time to read the detail of the OP message, but I use LXDE on Debian 11, so I can offer some information that might be useful to others in the thread. I configured all this years ago and it has been working ever since, so I have forgotten all the details. To achieve the same LXDE login configuration and environment as a console login, I have these two lines in $HOME/.xsessionrc: . "/etc/profile" . "${HOME}/.profile" (the double quotes just highlight strings in my editor) The file $HOME/.xsessionrc is sourced by /etc/X11/Xsession via /etc/X11/Xsession.d/40x11-common_xsessionrc which contains this self-documentation: # This file is sourced by Xsession(5), not executed. # Source user defined xsessionrc (locales and other environment variables) Some do-it-yourself tracing that I have placed into my scripts when I was trying to figure out how to get this working informs me that this is the sequence of events: lightdm(1310) > lightdm(1393) > Xsession(1414) . ~/.xsessionrc lightdm(1310) > lightdm(1393) > Xsession(1414) . ~/.profile lightdm(1310) > lightdm(1393) > Xsession(1414) . ~/bin/_my_export lightdm(1310) > lightdm(1393) > lxsession(1414) > lxpanel(1503) > x-terminal-emul(2403) > bash(2433) . ~/.bashrc The format of this data is: "parent(PID) > subparent(PID) > process(PID) some_statement_invoked_in_a_sourced_script_indented_if_child_of_above_script" The indented statements at the far right show the statements being executed in my instrumented scripts. 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. I assume that Xsession and lxsession are the same process because they have the same PID. 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. ~/bin/_my_export file is where I set and export environment variables so that this file can be sourced by either ~/.profile or ~/.bashrc as needed.