You would probably need to use AppleScript to discern the status of apps' windows being minimised or not, although you can run this AppleScript from the command line by using the command osascript
:
osascript <<OSA
use application "System Events"
set _P to a reference to (every process where the ¬
value of attribute "AXMinimized" of ¬
every window contains true)
set _Q to a reference to (every process where the ¬
value of attribute "AXMinimized" of ¬
every window contains true and the ¬
value of attribute "AXMinimized" of ¬
every window does not contain false)
-- every app that has at least one minimised window
name of _P
-- every app that has all windows minimised
# name of _Q
OSA
As you can see, I've defined two variables, _P
and _Q
, that both contains apps with minimised windows, but discriminate differently based on whether every window of the app or just some of the windows of the app are minimised.
I've commented out the last line of AppleScript, name of _Q
by putting a #
at the start. This means the script will ignore this line, allowing it to return the value of the line above it, which is name of _P
. If you remove the #
, the script will return the value of name of _Q
.