Starting user software in X
There are currently many ways of starting software when a user session starts.
This is an attempt to collect a list of pointers to piece the big picture together. It's partial and some parts might be imprecise or incorrect, but it's a start, and I'm happy to keep it updated if I receive corrections.
- Started by the display manager
- Debian specific
- Runs scripts in
~/.xsessionrcwhich can do little more than set env vars, because it is run at the beginning of X session startup
- At the end, it starts the session manager (
xfce4-session, and so on)
- Started by
pam_systemd, so it might not have a DISPLAY variable set in the environment yet
- Manages units in:
/usr/lib/systemd/user/where units provided by installed packages belong.
~/.local/share/systemd/user/where units of packages that have been installed in the home directory belong.
/etc/systemd/user/where system-wide user units are placed by the system administrator.
~/.config/systemd/user/where the users put their own units.
- A trick to start a systemd user unit when the X session has been set up and
the DISPLAY variable is available, is to call
systemctl startfrom a
- A user process making a dbus request can trigger starting a server program
- For systems debugging, is there a way of monitoring what services are getting dbus activated?
X session manager
- Run by
- Runs freedesktop autostart .desktop files
- Runs Desktop Environment specific software
- Run by the session manager
~/.config/autostart/foo.desktopexist then only the file
~/.config/autostart/foo.desktopwill be used because
~/.config/autostart/is more important than
- Is there an ordering or is it all in parallel?
Other startup notes
To connect to an X server, a client needs to send a token from
which proves that they can read the user's provate data.
~/.Xauthority contains a token generated by display manager and communicated
to X at startup.
To view its contents, use
xauth -i -f ~/.Xauthority list