toga icon indicating copy to clipboard operation
toga copied to clipboard

Integrate macOS documents with NSDocument?

Open johnzhou721 opened this issue 3 months ago • 3 comments

What is the problem or limitation you are having?

I don't see the native NSDocument class being used in Toga Cocoa. This native class (https://developer.apple.com/documentation/appkit/nsdocument?language=objc) has iCloud support for reading and writing documents and also renaming etc. supports.

I understand that Toga does not differentiate a document app anymore however the following dialog is expected by mac users in apps dealing with documents, and we should try to implement that.

Image

Describe the solution you'd like

When an application is a document app, somehow cooperate with the native NSDocument to manage the documents.

Describe alternatives you've considered

Status quo, however as far as I understand that will make Toga document apps not integrateable with iCloud.

Additional context

I'm sorry for the vagueness but as this has to do with apps and windows and stuff I am not in a position to propose a concrete solution.

johnzhou721 avatar Sep 22 '25 22:09 johnzhou721

In the not-too-distant past, Cocoa Documents did subclass NSDocument; however, we found that it wasn't necessary to achieve the feature set of Document-based apps.

If there's a specific new feature that we could add that requires NSDocument support on the backend, then we're open to suggestions, but it needs to be grounded in a specific feature that can potentially be implemented on other platforms. That doesn't mean we need to add iCloud support everywhere, but some broader notion of "Cloud integration" would need to exist.

freakboy3742 avatar Sep 23 '25 08:09 freakboy3742

@freakboy3742 If nothing else, it doesn't look like a native document app, as shown by my screenshot on the original post from Pages.

Renaming a file in place IIRC is something Microsoft Office supports. Microsoft has OneDrive although I'm not sure if these two features are like tightly coupled with concrete APIs like on macOS.

johnzhou721 avatar Sep 24 '25 02:09 johnzhou721

Hello!

I also have a few expectations of what the title bar should do (from left to right). I am still running Ventura, but I hope this all still applies:

  1. if a document was modified, the window close button should indicate that with a small black dot
  2. a file type icon should be displayed on the left of the filename
  3. cmd+click on the filename should popup a list with the directory structure where the file is located
  4. cmd+click on "untitled filename" should show a popup offering to save the file (cloud or no cloud)
  5. a small down arrow should be displayed on the right of the filename; click that should open the "save file popup"

bruno-rino avatar Oct 02 '25 14:10 bruno-rino