The use of a $HOME/.xinitrc file to customize X11 has been deprecated as of OS 10.5. Unfortunately, due to time constraints, we haven’t set down in the documentation what users should be doing. I hope to set some ideas down here to clarify the situation.
The old way:
The presence of a $HOME/.xinitrc file replaces the system’s default X11 startup sequence. A couple of consequences are:
- The user must make sure to run a window manager (unless one isn’t desired), e.g. just having
will generate an xterm with no window decorations, and any further X11 applications started from that xterm will be unmanaged. In this case the user probably wanted something like
- The user must make sure that $HOME/.xinitrc ends with a non-backgrounding command, or X11 will quit immediately. This would be the case in the prior example above if the user had
The new way:
Instead of a single $HOME/.xinitrc file, under the current incarnation of Apple’s X11 (and any Xorg 7, really), one can do the following:
- Create the directory $HOME/.xinitrc.d
- For anything you want to run, create an executable shell script in that directory. For example, to run Fink’s xpad application on startup, create a $HOME/.xinitrc.d/xpad.sh (the name is somewhat arbitrary, but see below) with contents
- It’s easy to keep a list of scripts that start one item, and to set whether they get run or not by using
chmod a+x <name of script>.sh
chmod a-x <name of script>.sh
and make it executable via
chmod a+x $HOME/.xinitrc.d/xpad.sh
Note that in this case you don’t have to set a window manager.
The window manager can be changed in the same way. There is only one subtlety: the contents of $HOME/.xinitrc.d are run in the order that the filenames appear in a listing, and generally one will want the window manager to be run last, so its script should be named appropriately. For example, you could have 0-xpad.sh and 99-evilwm.sh scripts to run the evilwm window manager and start xpad automatically.
Note: It’s slightly more complicated to set things up for GNOME or KDE, and I will discuss that issue in a subsequent entry.