[Qt-interest] GUI Application List?
Thomi Richards
thomir at gmail.com
Tue Aug 4 10:27:04 CEST 2009
2009/8/3 Ben Axelrod <baxelrod at coroware.com>:
> Does anyone know how to get the list of currently running GUI applications
> on Linux programmatically? (Note: I do not mean ps, although I may have to
> resort to that). I imagine there must be some way to poke the window
> manager for this info. I am doing this through Qt, so if there is a
> cross-platform way to do this, that would be best. But I am focusing on
> Linux for now.
>
Wow, what a co-incidence. I just had to do this the other day. What I
ended up doing is using the XLib API. I settled on an approach that
works for any window manager that supports the Extended Window Manager
Hints (KDE and Gnome do, probably a few others as well).
You can see some of the code I ended up usiong gere:
http://stackoverflow.com/questions/1201179/how-to-identify-top-level-x11-windows-using-xlib/1211242#1211242
Essentially you need to query the root window for the
"_NET_CLIENT_LIST" property.
HOWEVER, this can be a bit buggy - under KDE (for example) older X11
programs (such as 'xcalc') don't shop up in this list. I have yet to
get around to working this one out.
HTH!
More information about the Qt-interest-old
mailing list