On macOS, there’s 1 active window that receives your key input. Then there’s all the other windows, which are potentially invisible or obstructed by other windows. These inactive windows can be brought to the front and made active with a click. Then you can interact with these windows like normal. With inactive but visible windows, you cannot select items from lists, for example. The UI reflects this with a greyed-out or dimmed representation. You need to click once to activate the window (on the surface of the window, so to speak), then another time to interact with the control.
Continue reading …
I noticed that in macOS’s dark mode, a window without a visible title bar won’t draw a light border. It will draw a dark/black border, unlike all the other windows, and thus be a lot less visible than it needs to be. So for a floating helper window, I had to make the title bar visible, and then hide all traffic light buttons in the window’s top-left corner:
Continue reading …
People in Slack asked me why I didn’t use another mechanism to get notified when NSWindow
s are shown. Here’s what I was suggested and what I found: NSWindow.didChangeScreenNotification
:
Does not fire for all windows showing for the first time, and if it fires, if firest only once. Closing and re-showing the window will not trigger the notification again.
Continue reading …
How do you observe for changes to the list of visible/known/active NSWindow
instances in your app? There’s NSWindow.willCloseNotification, but there’s no equivalent like a willShowNotification
or didShowNotification
(except for NSPopover
). I don’t know why, but I do find it strange.
Continue reading …