sindresorhus / Settings

⚙ Add a settings window to your macOS app in minutes
MIT License
1.45k stars 101 forks source link

Switched from NSWindow to NSPane #124

Closed chbeer closed 5 months ago

chbeer commented 5 months ago

An NSPane is „A special kind of window that typically performs a function that is auxiliary to the main window.“ and therefore suited better for the use case.

sindresorhus commented 5 months ago

NSPanel's have a lot of uses, but it doesn't fit for a settings window. A settings window is not auxiliary to the main window, it's just another window in your app.

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Concepts/UsingPanels.html#//apple_ref/doc/uid/20000224

chbeer commented 5 months ago

Sorry to come back to this closed request, but I disagree with your opinion regarding NSPanel for settings, and I can support my opinion with what Xcode does:

image

Others use NSWindow, true. In document based apps, using NSPanel is, at least, a good idea because that way the document window can stay main window and the NSPanel can be auxiliary to it. That way the "current document" window isn't lost.

sindresorhus commented 5 months ago

Apple has been inconsistent about this in the past, but I think the best reference point is SwiftUI.Settings, which uses NSWindow, even when the app is a document-based app (DocumentGroup).

sindresorhus commented 5 months ago

In document based apps, using NSPanel is, at least, a good idea because that way the document window can stay main window and the NSPanel can be auxiliary to it. That way the "current document" window isn't lost.

Windows can be auxiliary without being NSPanel. However, it seems like we are currently not preventing this. Can you try out this: https://github.com/sindresorhus/Settings/pull/125