pfr For example, some things need to end in & and some don't.
The .xinitrc
file is just a shell script and the normal rules of shell scripts apply. There is just this one caveat: All long running programs in it, except the last one, must be started in the background (otherwise, the script would block there, no?).
You can see what happens if you look at the startx
script. It does a bunch of things, then executes this command:
xinit "$client" $clientargs -- "$server" $display $serverargs
The xinit
program first runs the X server, then runs a shell to execute ~/.xinitrc
--which is where you put your initial X clients. And, when .xinitrc
ends, so does your session. xinit
will then (as the man-page explains) kill the X server and terminate at which point startx
will execute the clean-up stuff which comes after that xinit ...
line.
Now, we can see why .xinitrc
is an odd shell-script. If every long-running program in it were started in the background with an &
--or you only had one-shot commands like xsetroot
etc--then the script would start and end immediately. Therefore, you have this one long-running program which is started in the foreground; and when this programs exits, so does .xinitrc
. This last program is typically a window manager, but, it doesn't have to be. You can run a xterm
as the final program instead (and the window manager before it--in the background) and when you quit that xterm
with a Ctrl-D, your X session will end as well.
pin You don't really need this,
mkdir /tmp/${USER}-runtime && chmod -R 0700 /tmp/${USER}-runtime
export XDG_RUNTIME_DIR=/tmp/${USER}-runtime
I have it to avoid Qt-apps spiting-out garbage.
That might be used by dbus
and friends--which in turn is needed by firefox
.