The rc file Debian
(and probably other distro
s) seems to use for running X11
This file is just a normal shell script. Basically, it should run session setup programs (xsetbg and whatever) normally, start tools and applications on background, and then, as the last command, fire up the window manager (to end the session, one must exit the window manager).
This is the Right Way™. The newbies often insist otherwise, thinking GNOME or KDE session management is better (OK, it sometimes is). But they're newbies, so their lust for easy to use tools is naturally forgiven. If you want Power, you use .xsession.
xrdb -merge ~/.config/Xdefaults
xscreensaver -nosplash &
exec ~/.config/xsession-banner.sh &
This example first runs one setup program (xrdb, which reads X AppDefault file and merges it to current settings), then starts XScreenSaver, starts my banner script (displays a small message with xmessage), and finally starts WindowMaker. If I would want some post-session things, I'd need to put them after "exec wmaker" line.