Noitidart
Noitidart

Reputation: 37298

Order array of windows by z order

I read this about stack order / z order of windows on X11:

To obtain good interoperability between different Desktop Environments, the following layered stacking order is recommended, from the bottom:

windows of type _NET_WM_TYPE_DESKTOP

windows having state _NET_WM_STATE_BELOW

windows not belonging in any other layer

windows of type _NET_WM_TYPE_DOCK (unless they have state _NET_WM_TYPE_BELOW) and windows having state _NET_WM_STATE_ABOVE

focused windows having state _NET_WM_STATE_FULLSCREEN

I was able to use get the _NET_WM_USER_TIME atom to order windows. I used XQuerySubtree and XGetWindowProperty. But it's not the best solution, as lots of times it gets the window before the most recent window. Code here: https://gist.github.com/Noitidart/60aab0a96f060240614f

I was wondering if there was a way to get windows by z order?

Upvotes: 1

Views: 2074

Answers (1)

Andrey Sidorov
Andrey Sidorov

Reputation: 25466

Moved from comments:

XQueryTree does return children sorted by stacking order:

The children are listed in current stacking order, from bottommost (first) to topmost (last)

Answer to "is there any way to do a quick test if the window is visible in task bar / task switcher" is "check if it's _NET_WM_WINDOW_TYPE_NORMAL window"

Upvotes: 2

Related Questions