startx
and ~/.xinitrc
isn't the only method of starting an X11 environment. Most desktop environments come with a "display manager" daemon which automatically starts Xorg on all available monitors, and shows a graphical login screen.
While some display managers do try to run ~/.xinitrc
themselves, most DMs take the list of available "sessions" from /usr/share/xsessions/*.desktop
.
As for the other question – starting programs when the desktop environment starts – there usualy are two methods, as in my earlier post:
According to the XDG Autostart specification, the desktop environment's "session manager" (e.g.
cinnamon-session
) will read the programs from~/.config/autostart/*.desktop
. You can manage them usingcinnamon-session-properties
.Some display managers will read the
~/.xprofile
script, which works similarly to~/.xinitrc
but without starting a window manager (as that's already done by the session manager).