tags:

views:

61

answers:

1

I want to check which Window Manager the user is using (like GNOME or KDE etc.). How do I do that?

A: 

You can't. There is no central place where a program registers itself to say "hi, I'm the window manager".

For instance, I'm running xmonad. I simply start this by calling xmonad in my ~/.xsession file along with a couple of other programs to have it start when I login. You cannot really detect that.

Daniel Egeberg
I just thought of something, the Window Manager is just like any other program right? So it is in the processes list, for example, I'm running GNOME, and I got a process called 'gnome-sessions'. So I could check if that process is running so I know the user uses GNOME. You can't run 2 or more WM's at the same time anyhow right?
Jay
@Jay: Sure, if you have a list of all window managers, I suppose you could. There are a lot of different ones though. You cannot make a general solution.
Daniel Egeberg
See `xnest` or `Xephyr` or `startx -- :1` for reasons why your assumption of "can't run 2 or more WM's at the same time" is incorrect.
sarnold