I have a bash script that moves my windows from the left screen to right screen in dual-screen setup. Currently the way it works is cycling through the window ids that are given by xdotool search --onlyvisible --maxdepth 2 --class ""
and then moves them to the right by the screen width. It already works... unless the window in question is maximises or minimised.
So what is needed is a way to check the current status of the window. I have found an answer that provides the way to add and remove those bits, but where is the way to check if they are set already?
If it is not possible to do via xdotool, it should be possible to reuse the window id provided by the command mentioned above.
Retrieve info on the window state
You can get the info (and a lot more) from the command:
To get what you are specifically looking for:
The output will look like:
on a window that is maximized (h + v) and minimized at the same time, or just
(or no output at all) if none of those is the case.
More fun
Of course, using various languages, you can use Wnck, like in the python snippet below. (snippet from window-shuffler). The snippet outputs a list, showing the window name + either
True
orFalse
(minimized).Output looks like:
N.B.
xprop
will handel both hex (as output from e.g.wmctrl
) and decimal (as output from e.g.xdotool
) id's equally e.g. either use:or
Methods will not work on Wayland!