Topic: Determine which window manager is running

Any one know a way to detect which window manager is running using Python. I'm working on a little app that needs to save files in different location depending on if fluxbox or openbox is running.

"An educator never says what he himself thinks, but only that which he thinks it is good for those whom he is educating to hear."
-Nietzsche

Re: Determine which window manager is running

hmmm, something crude and from my imagination without any testing:

ps waux | grep fluxbox | wc -l

If the result is greater than 0 then fluxbox is running

"UBER" means I don't drink the coffee... I chew the beans instead
             -- Copyright BSDnexus

Re: Determine which window manager is running

Thanks for the suggestion.

I was thinking that there should be some kind of variable in X11, something along the lines of WM properties. Although I can't seem to find anything.

That way if I decided to add in another window manager it would not be much of a change.

"An educator never says what he himself thinks, but only that which he thinks it is good for those whom he is educating to hear."
-Nietzsche

Re: Determine which window manager is running

WIntellect wrote:

hmmm, something crude and from my imagination without any testing:

ps waux | grep fluxbox | wc -l

If the result is greater than 0 then fluxbox is running

pgrep fluxbox would be actually much shorter and more straight-forward ;-)

If the return code is 0, then some app with 'fluxbox' in name is running.

Last edited by Maxx (2007-07-09 23:47:40)