@f do you follow @stroughtonsmith? He posts on related topics
@f This page from Craft’s Catalyst guide might have something useful:
@f 👍🏼 Full doc is here: https://www.craft.do/maccatalyst-guide
@f @trode you want something like this in your AppKit bundle, where you set a specific frame autosave name for the NSWindow (AppKit bundle a la https://github.com/steventroughtonsmith/CatalystPrefsWindow/blob/main/AppKitIntegration/AppKitController.swift)
@f while I can't guarantee your specific use-case, these things generally need to be set from the callback I use in that project (triggered by private notification) as timing matters during window construction
@f I have been working on a Mac Catalyst app and thanks to your question just noticed it has the same re-launch problem. I'll be looking at it more in the morning, thanks.
@f @stroughtonsmith I modeled what I'm doing off of his example, but I still see the problem. If I just launch the CatalystPrefsWindow (without the Preferences showing), move/resize, press the close button, and then re-open the window from the dock, it opens at the original position/size in the middle of the screen. If instead of using the close button, I switch to Xcode and terminate it from Xcode, then when I launch the app again from Xcode, it opens in the new position/size.
@stevengharris @f could be a few things going on here; Catalyst apps don't quit immediately when you quit them, they stay alive long enough to save state. Killing with Xcode will kill them outright. State restoration behavior is what can interfere with window frame, as all windows in Catalyst use state restoration by default (which you can turn off at the AppKit level if necessary)
@stroughtonsmith @f Thanks. (That prefs example and others have been a huge help.) If the Catalyst app is put in the background by selecting Xcode or another app, then it saves state properly, and can then be killed with Xcode and have state restored, which works fine. The case that is (I think) a problem is pressing the close button on the app itself. In that case, it always re-opens in the middle again with default size
@stevengharris @f when you hit the close box, you are intentionally throwing the state away — a new window is created on next launch. Using the frame autosave name through AppKit *should* take precedence, though