All native controls have different appearance when their parent window is active or inactive. How should we check this state in custom components e.g. while rendering a button cell?
We could inspect controlView.window
’s properties like isMainWindow
and isKeyWindow
, but they don’t cover all cases. For instance, if you open one window of the app on the Desktop and another in a full-screen Space, only one of them can be key or main according to public APIs. However, standard controls seem to render them as active in both Spaces:
Please note how toolbar buttons in both Safari windows are rendered as active. How do we achieve the same behavior?
NSWindow.hasActiveAppearance
. – DyslogiaNSWindow.hasActiveAppearance
covers every cases. But the property is not KVC-compliant so we either need to find a private notification for it or use a timer to get updates. – Jameejamel