I'm developing a Cocoa application that shows a list of opened windows and highlights the current focused one. My problem is that I can't find a system notification to inform my app that the main (aka "focused" or "foreground") window has changed. I tried with:
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(wsNotificationHook:) name:NSWorkspaceDidActivateApplicationNotification object:nil];
but it monitors APPLICATION change: it isn't get fired when a change of window is executed INSIDE the same application (for example, if I pass between two Firefox windows using exposè). Is there a system-wide event that I can monitor to track a change of the main window?
Thank you in advance!
Force a Relaunch Forcing an app or program to relaunch on a Mac could bring the window back into view so you can access it again. Click the Apple icon located in the top left corner. Select Force Quit. Choose the off-screen application from the list and click Relaunch.
Hi. On the application menu bar go to Window/Zoom, and then resize and position the window as you like. In order to make it open the same way next time you use the application, hold the Option key while closing the window. Good Luck.
Show all open windows grouped by app: In Mission Control preferences, select “Group windows by application,” then enter Mission Control. Move open windows aside to show the desktop: Press Command-Mission Control , or spread your thumb and three fingers apart on the trackpad.
Fix 2 – Resolution Select the Apple Menu, then choose “System Preferences…” > “Displays“. Ensure “Scaled” is selected under “Resolution“. Choose any other setting. This should force the window for the application back on the screen where you can drag it to a safe place.
The closest you'll get will probably be the accessibility APIs. See here and here for similar questions with (partial) solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With