What's the Right Way to read resources on X startup?
What's the Right Way to read resources on X startup?
- Subject: What's the Right Way to read resources on X startup?
- From: Richard Cobbe <email@hidden>
- Date: Sun, 20 Jun 2010 21:09:07 -0400
- Mail-followup-to: X11 Users <email@hidden>
I'm running XQuartz 2.5.1_rc1 on MacOS 10.6.4. What's the Right Way (tm)
to load X resources on startup? I'm particularly interested in avoiding a
race condition between the xresources load and the start of the initial
client application.
In more detail:
I have some resource settings, some of which affect xterm, in ~/.Xresources
-- the location where /opt/X11/lib/X11/xinit/xinitrc appears to look for
them.
I generally start X by running a Unix executable that I wrote myself, which
sets up a specific environment, then forks and execs /opt/X11/bin/xterm in
the background, then immediately terminates. (Full source and additional
details of why I'm fiddling with the environment are available on request.)
I've added this binary to the programs that start automatically when I log
in. On login, then, this executable gets run, and it runs xterm, which in
term causes launchd to start XQuartz. However, sometimes the xterm starts
before loading the X resources in ~/.Xresources, and sometimes it starts
afterward.
In cases where the xterm starts before xrdb is run, I can just type "xterm
& exit" at the bash prompt in that terminal, and this new xterm clearly
picks up the resource settings. So they're definitely getting loaded at X
startup, it's just a race condition as to whether xrdb or xterm runs first.
What's the best way to avoid this? I could put a call to sleep in the
executable that starts the xterm, but that's ugly and not particularly
robust.
In earlier attempts to get this working, I had scripts in
~/.xinitrc.d/00-resources.sh and ~/.xinitrc.d/99-xterm.sh that would
respectively load the resources and start the initial xterm. In this case,
I had XQuartz.app in my login items rather than the start-the-xterm
program. The race condition happened here as well.
Thanks,
Richard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden