Repository navigation
macOS: open presentations from Finder (double-click, Open With, Dock) - #1028
Open
eskimoburger wants to merge 1 commit into
Open
eskimoburger wants to merge 1 commit into
eskimoburger wants to merge 1 commit into
Conversation
A Finder double-click, Open With or `open -a DeckCraft talk.pptx` brought the app up on File > Home with nothing open, and DeckCraft wasn't offered for presentations at all: - Info.plist had no CFBundleDocumentTypes, so LaunchServices didn't know DeckCraft opens .deckcraft, .pptx, .potx or .ppsx. - Finder doesn't pass paths on the command line; it sends a kAEOpenDocuments Apple event, which winit 0.30 doesn't handle. Declare the document types (Owner for .deckcraft, Alternate for the Open XML presentation types) and handle the Apple event with fmv-macos-events, the crate WordCraft already uses for the same thing (no unsafe here). Opened paths go through open_from_system, so a .ppsx still starts its slide show and failures land in the log and the status bar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
FredApps
reviewed
Oct 19, 2026
FredApps
left a comment
Contributor
There was a problem hiding this comment.
I read the diff against WordCraft's apple_events.rs and Info.plist.in (the pattern this copies), the engine's open path, and the new dependency. I can't run macOS or cargo here, so this is by my reading, and the Finder behaviour itself rests on the author's own run (macOS 27, open -a with the app closed and running).
Verified:
- The dependency.
fmv-macos-events 0.1.0is pinned exactly (=0.1.0) and macOS-only. I downloaded the.cratefrom crates.io: its SHA-256 is90642cf6…23fe55, the checksum in the lock hunk, and WordCraft's lock has the same entry (sameobjc2 0.6.5,objc2-app-kit 0.3.2,objc2-foundation 0.3.2, which are already in this lock under those versions, so the lock adds only the one package). It is MIT OR Apache-2.0 and itsunsafestays inside the crate, so#![forbid(unsafe_code)]still holds for the app. - The module.
apple_events.rsis WordCraft's line for line except the handler: it goes throughSlideApp::open_from_system, the function the command-line files use, so the.ppsx-starts-the-show rule is shared. The session is multi-document andfile.openadds a document, so a Finder open while another deck has unsaved changes doesn't replace it;Quitbecomes a window close, which keeps the existing unsaved-changes prompt (lib.rs:1576). - Wiring. The handler is installed before
run_native, so it sees the launch event; the inbox is drained inlogicand wakes the context for later events. The tuple field and the test constructor arecfg-gated consistently, so other platforms compile the same as before. - The plist. The exported UTI
ai.storyteller.deckcraft.presentationmatches the newLSItemContentTypes; the icon nameDeckCraftmatches whatpackage.shcopies into the bundle (DeckCraft.icns);.deckcraftisOwnerand the Open XML types areAlternate, as WordCraft does for.docx. The engine openspptx,potxandppsx, so all three listed types can be handled. - DeckCraft has no translation catalogs (every other
set_statusis a plain Englishformat!), so the new "Couldn't open …" status needs no catalog rows.
Two things I can't confirm from here (neither blocks):
Info.plist.inimports onlyorg.openxmlformats.presentationml.presentation, but the second document type also names.templateand.slideshow. If macOS doesn't declare those two itself (it may depend on Office being installed), LaunchServices ignores them and DeckCraft isn't offered for.potx/.ppsx. WordCraft does the same for.dotx, so this matches the suite, but a quick check of Open With on a.ppsxon a Mac without Office would tell.- The description says
control_server::tests::a_line_that_is_not_a_request_closes_the_connectionfails on unmodifiedmainon the author's machine. That may be machine-specific, but it needs a clean run on another host before this lands.
This stays a comment: no CI has run on this head, and I have no macOS result for it.
Validation request (head e90d3676590ec26ff7cc20a79821816d2c33da47):
- os: macos (apple silicon), and linux and windows for the build
- commands:
cargo fmt --all -- --check;cargo clippy --workspace --all-targets --locked -- -D warnings;cargo test -p deckcraft --locked; package the app and runopen -a DeckCraft deck.pptxwith the app closed and running, a double-click and Open With on.pptx,.ppsx,.potxand.deckcraft, a drop on the Dock icon, and Quit from the Dock with unsaved changes - expected: all pass, 0 ignored (including
a_line_that_is_not_a_request_closes_the_connection); each file opens, a.ppsxstarts its show, quit asks about unsaved changes - holds: no macOS receipt for this head; the control_server test result on a second host
5 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS (0.8.0 DMG), double-clicking a
.pptxin Finder, using Open With, dropping a file on the Dock icon, or runningopen -a DeckCraft talk.pptxlaunches DeckCraft on File › Home with nothing open. DeckCraft also isn't offered in Finder's Open With list for presentations.Two causes:
packaging/macos/Info.plist.indeclares the UTIs (UTExportedTypeDeclarations/UTImportedTypeDeclarations) but noCFBundleDocumentTypes, so LaunchServices doesn't know DeckCraft can open them.kAEOpenDocuments('odoc') Apple event, which winit 0.30 doesn't handle. Onlyopen --args file.pptxworked.WordCraft and GridCraft already handle both; DeckCraft was missing them.
Fix
Info.plist.in: addCFBundleDocumentTypes:.deckcraft(Owner) and the Open XML presentation, template and slideshow types (Alternate, as WordCraft does for.docx).apps/deckcraft/src/apple_events.rs(new): register anNSAppleEventManagerhandler throughfmv-macos-events = "=0.1.0", the same crate and pattern asapps/wordcraft/src/apple_events.rs. It's installed before the event loop, so it also catches the event that launched the app, and the frame loop drains it. Nounsafein this workspace.SlideApp::open_from_system, the same path the command-line files take, so a.ppsxgiven last still starts its slide show. Failures are logged and shown in the status bar. A quit Apple event closes the window, so the unsaved-changes prompt still runs.Testing (macOS 27, Apple silicon)
cargo build --release -p deckcraft, put the binary and renderedInfo.plistinto the 0.8.0 app bundle (ad-hoc signed) and registered it withlsregister.open -a DeckCraft deck.pptxwith the app not running. The deck opens; before the fix it stayed on Home.open -a DeckCraft other.pptxopens the second deck. Both appear in the Recent list.cargo fmt --all -- --checkandcargo clippy -p deckcraft --all-targets -- -D warningsare clean.cargo test -p deckcraft, 32 tests pass andcontrol_server::tests::a_line_that_is_not_a_request_closes_the_connectionfails. It fails the same way on unmodifiedmainon this machine, so this change didn't cause it.cargo xtask cibecause it expects the siblingcraftrules/craft-fontscheckouts.🤖 Generated with Claude Code
Summary by CodeRabbit
.deckcraftpresentations and supported PowerPoint files from Finder.