Question

I'm working on an app that is marked as LSUIElement and its main window is a NSPanel 'attached' to the status bar. Sometimes I need to display a normal alert panel (either by using NSRunAlertPanel or NSAlert). However, it's very important that the panel is always shown on the space the user is currently on (otherwise the user might not see it immediately and it's important that he does).

The problem is that alerts are always shown on the space where the user last interacted with the application's windows, NOT on the current space. So, for example, if on space number 1 I open and close my app's NSPanel, then I move to space number 2 and some time later my app shows an alert, that alert will be shown on space number 1, not 2. And thus I (or the general user) won't see the alert until I decide to switch to the first space.

Is there any way to change this behavior (= to make an alert always show on the current space)?

Was it helpful?

Solution

Not exactly what you're asking, but maybe before you show your alert window set its collection behavior to NSWindowCollectionBehaviorCanJoinAllSpaces using setCollectionBehavior:. The window should then appear on all spaces, which includes the current one...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top