79406411

Date: 2025-02-02 10:35:03
Score: 1.5
Natty:
Report link

You can’t observe the onActiveSpace property because SkyLight does not support that feature. If you really want to observe it, you can either observe the private notification named _NSWindowDidChangeWindowNumber or override -[NSWindow _commonAwake].

But I want to ask: why? The onActiveSpace property indicates that NSWindow has created an NSCGSWindow and that it is connected to the WindowServer’s space. If it’s a tabbed window and that tab is not selected, it will return NO. Why do you want to observe this? If you initialized NSWindow with defer:YES, NSWindow will be on the space immediately.

If you want to determine whether a window is visible to the user, you need to use the occlusionState and observe the NSApplicationDidChangeOcclusionStateNotification.

Reasons:
  • Blacklisted phrase (0.5): why?
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Jinwoo Kim