How to check if window is top most


#1

Can one check if a window is at the top of other windows, i.e. not obstructed by any other window?

Or maybe there is some other way how to do this that I’m missing:

on-tray-icon-click:
if minimized
    show+focus
else
    if obstructed
        focus
    else
        minimize

Changing "is obstructed" to "is !focused" check would also suffice, unfortunately clicking on tray icon blurs the window so "is !focused" would always be true.