
Wow! Stefan, you never cease to amaze me. Mike Stefan O'Rear wrote:
On Fri, Aug 03, 2007 at 02:09:00PM -0700, Michael Vanier wrote:
Huh, I think I was asking the wrong question then. I don't really want to do all the things that are done in my .xinitrc file. I noticed, though, that (for instance) my .Xresources are ignored inside the xnested xmonad, so I have to do
xrdb ~/.Xresources
again to get them to work right (presumably because xnest is running X on display 1, not 0). Similarly, I have to do "xsetroot -solid black" again to get a black background. So I put these commands in my startup script like this:
#!/bin/sh
Xnest :1 -name "xmonad" +kb -ac -geometry 1152x768 2> /dev/null & XNEST_PROC=$! DISPLAY=:1
xsetroot -display :1 -solid black xrdb -display :1 $HOME/.Xresources
/usr/local/bin/xmonad& XMONAD_PROC=$!
wait $XMONAD_PROC kill $XNEST_PROC
but the xrdb and xsetroot commands did nothing. However, if I did it like this:
#!/bin/sh
Xnest :1 -name "xmonad" +kb -ac -geometry 1152x768 2> /dev/null & XNEST_PROC=$! DISPLAY=:1
/usr/local/bin/xmonad& XMONAD_PROC=$!
xsetroot -display :1 -solid black xrdb -display :1 $HOME/.Xresources
wait $XMONAD_PROC kill $XNEST_PROC
it works fine. I don't know why this is -- does xmonad have to be running in order for the xsetroot and xrdb commands to take effect? Why should that be?
X11 Protocol Specification, chapter 10, paragraph 3:
A server goes through a cycle of having no connections and having some connections. At every transition to the state of having no connections as a result of a connection closing with a Destroy close-down mode, the server resets its state as if it had just been started. This starts by destroying all lingering resources from clients that have terminated in RetainPermanent or RetainTempo- rary mode. It additionally includes deleting all but the predefined atom identifiers, deleting all properties on all root windows, resetting all device maps and attributes (key click, bell volume, acceleration), resetting the access control list, restoring the standard root tiles and cursors, restor- ing the default font path, and restoring the input focus to state PointerRoot.
So after xsetroot exits, the server resets. After xrdb exits, the server resets. xmonad starts with a clean setup.
This (mis)feature is not an issue if you use xinit/startx because xinit itself counts as a connected client.
Stefan