phoenix
phoenix copied to clipboard
Event for when window moves to a new space
- Version: 2.6 (62)
- macOS: 10.13.2
I am trying to build a configuration which allows a space to manage the windows it contains. However, I'm unable to find an elegant way to detect when a window has been moved to a different space. The events windowDidMove
and windowDidResize
do not fire, as I suppose the moved window doesn't actually change size.
Is this possible without continuously polling which windows belong inside which spaces?
Cheers :)
Hi! Unfortunately the only viable option currently is to poll. Apple doesn’t provide really any public APIs for Spaces and if I remember correctly there’s no private one for this either. I’ll be sure to check this again.
Hmm. I wonder if you could use NSAccessibilityFocusedWindowChangedNotification
to detect this, i.e. presumably if you move the window, another window will become the focused one for the current space.
Wonder if NSAccessibilityFocusedWindowChangedNotification
would allow for detecting loss of window focus. Would love to be able to hide a window when the user clicks away.
@lukesmurray It should, you can try using the windowDidFocus
event which is exactly the event mentioned above.
yup! it works 🥳 Love this library
@lukesmurray Thanks! I appreciate the kind words!