However, in the interests of completeness, that relates to KDE only. Gnome has something similar, I'm sure. But, if you want to run a different Window Manager, and still have the functionality of the above, then you should try this in your ~/.xinitrc
# Example .xinitrc file
Notice how both gkrellm and xterm have the & at the end, but the Window Manager doesn't. When using .xinitrc, you need to start all the programmes you want to run before
the Window Manager. Therefore, the Window Manager should be the last line on your .xinitrc (except for comments) so when you close the Window Manager, X closes too.