mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-03 06:51:50 -06:00
macOS: open PDFs from Finder, Open With and the Dock (#73)
Finder hands files to an app as an Apple event, not on the command line. winit doesn't handle it, so AppKit answered "PrintCraft cannot open files in the PDF document format". The bundle also declared no PDF document type: its Info.plist still carried the sibling image editor's types. - Info.plist declares PDF (by extension and MIME type) as a document type, role Editor, rank Alternate: offered under Open With and settable as the default, without taking over on install. - apps/printcraft registers open-documents and quit Apple event handlers through fmv-macos-events (=0.1.0, the audited safe wrapper PhotoCraft uses, since the Objective-C interop needs unsafe), before the launch event arrives. - printcraft-ui-egui gains OsEvent and PrintCraftApp::os_events, polled every frame: Open opens each file as File > Open does; Quit closes the window like its close button, so unsaved changes are asked about. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2e49a84ace
commit
f50c5a4e88
@@ -45,64 +45,23 @@
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © the PrintCraft authors. MIT OR Apache-2.0.</string>
|
||||
|
||||
<!-- Printcraft's own format. -->
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<!-- Documents PrintCraft opens (#73): it is offered under Open With and can be made the default
|
||||
for PDFs, without taking over from the system's viewer on install ("Alternate"). Declared by
|
||||
extension and MIME type; LaunchServices maps them to the system's PDF type. Finder hands the
|
||||
file over as an Apple event, which apps/printcraft/src/apple_events.rs receives. -->
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>ai.storyteller.printcraft.document</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>PrintCraft Document</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
<string>public.image</string>
|
||||
</array>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>PrintCraft</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array><string>pcraft</string></array>
|
||||
<key>public.mime-type</key>
|
||||
<array><string>application/x-printcraft</string></array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<!-- Types macOS may not know; the system's own declaration wins when it has one. -->
|
||||
<key>UTImportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.adobe.photoshop-large-image</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Photoshop Large Document</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
<string>public.image</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array><string>psb</string></array>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>ai.storyteller.printcraft.qoi</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>QOI Image</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
<string>public.image</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array><string>qoi</string></array>
|
||||
</dict>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>PDF Document</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array><string>pdf</string></array>
|
||||
<key>CFBundleTypeMIMETypes</key>
|
||||
<array><string>application/pdf</string></array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user