Reputation: 1367
I want to run a minimal X session with just a window manager and a single fullscreen program. The obvious way to do this is by putting something like this in .xinitrc:
metacity & # this could be any window manager
exec my-fullscreen-app
But since these are launched in parallel, there's a bit of a race condition. I don't want my app to appear before the window manager is ready, because then there will be a visible resizing of its window to fullscreen mode. I want to make sure the window manager has finished initializing first.
The best I've come up with is something like this:
metacity &
while ! xprop -root | grep -q _NET_SUPPORTING_WM_CHECK
do
sleep 0.1
done
sleep 0.3
exec my-fullscreen-app
But just because _NET_SUPPORTING_WM_CHECK has been set on the root window doesn't necessarily mean that the WM is truly ready, and the 0.3 second sleep after it is a kludge that might be serious overkill on some systems and might be totally inadequate on others.
So is there a better way to reliably sense that the window manager is fully initialized?
Upvotes: 1
Views: 738
Reputation: 8467
Short answer is no, there's no way.
metacity in particular still has stuff left to do after setting the _NET_SUPPORTING_WM_CHECK property.
I think your approach is about the best you can do.
On the plus side, unless there are bugs, the race should not have any effects other than cosmetic ones. (i.e. things are shown that aren't in their final state)
To mitigate, you might want to set your window to fullscreen size manually before mapping it. Then let the WM set the size after that.
Upvotes: 1