KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to get a list of all top level desktop windows in an X11 session. Basically, I want to get a list of all windows that are shown in the window managers application-switching UI (commonly opened when the user presses ALT+TAB). I've never done any X11 programming before, but so far I've managed to enumerate through the entire window list, with code that looks something like this: void CSoftwareInfoLinux::enumerateWindows(Display *display, Window rootWindow) { Window parent; Window *children; Window *child; quint32 nNumChildren; XTextProperty wmName; XTextProperty wmCommand; int status = XGetWMName(display, rootWindow, &wmName); if (status && wmName.value && wmName.nitems) { int i; char **list; status = XmbTextPropertyToTextList(display, &wmName, &list, &i); if (status >= Success && i && *list) { qDebug() << "Found window with name:" << (char*) *list; } status = XGetCommand(display, rootWindow, &list, &i); if (status >= Success && i && *list) { qDebug() << "... and Command:" << i << (char*) *list; } Window tf; status = XGetTransientForHint(display, rootWindow, &tf); if (status >= Success && tf) { qDebug() << "TF set!"; } XWMHints *pHints = XGetWMHints(display, rootWindow); if (pHints) { qDebug() << "Flags:" << pHints->flags << "Window group:" << pHints->window_group; } } status = XQueryTree(display, rootWindow, &rootWindow, &parent, &children, &nNumChildren); if (status == 0) { // Could not query window tree further, aborting return; } if (nNumChildren == 0) {
Tags (comma-separated)
Save Edits
Cancel