How can I be notified if another app goes full screen on macOS?

Is there any way I can know that another app has gone full screen? Please note that this is not what NSWindowDidEnterFullScreenNotification does, that only works for my own windows.

As for why I need to know: Say you're playing a YouTube video full screen. The video fills up the main display, and if there's a second display, it goes black. Well, mostly. I have a utility app with small status windows that remain on top. I'd like to be polite and hide them in this scenario.

If there is a way to get notified when another app goes full screen, I'm unaware of it.

If it isn't appropriate for your status windows to ever be displayed in full screen mode have you tried using NSWindowCollectionBehaviorFullScreenNone on these windows?

I have a window that should display in full screen sometimes, and like you I want to be polite and initially hide it.

I've been using a hack forever to do this which mostly works but it isn't exactly pretty.

It involves creating a hidden window with a certain collectionBehavior like NSWindowCollectionBehaviorFullScreenNone | NSWindowCollectionBehaviorCanJoinAllSpace and basically track if the active space contains this window. If it doesn't I assume the active space contains an app with a full screen window. Again not perfect but it's the best I could think of.

If there is a better way to do it, I'd also like to know.

How can I be notified if another app goes full screen on macOS?
 
 
Q