Skip to content

Choose which slicer Open in Slicer uses - #155

Merged
vycdev merged 1 commit into
vycdev:developfrom
officialasishkumar:feat/issue-152-choose-slicer
Nov 16, 2026
Merged

vycdev merged 1 commit into
vycdev:developfrom
officialasishkumar:feat/issue-152-choose-slicer

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Open in Slicer from #148 always opened the 3MF with the operating system's default .3mf app. If that default was a 3D viewer, or you use more than one slicer, you had to change OS file associations first. This adds the parts of #69 that #148 left out: choosing the slicer, remembering it, built-in presets, and Browse.

What changed

Behavior

  • Clicking Open in Slicer now opens a chooser before the 3MF is built. It offers System default (the old behavior), every installed preset slicer, and Browse….
  • Always use this slicer saves the choice. After that, clicks open the model straight away and the menu item names the slicer ("Open in Orca Slicer"). A Choose Slicer… item appears in the same menu so you can change the choice; turning the switch off and opening clears it. You can also save System default.
  • If the saved slicer was moved or uninstalled, Kromacut forgets it and shows the chooser again, saying "Orca Slicer could not be found. Choose another slicer."
  • If the chosen slicer fails to launch, you get the same localized error as before (b2873f4).

Native (src-tauri/src/slicer_apps.rs)

  • list_slicer_apps looks for Bambu Studio, Orca Slicer, PrusaSlicer and UltiMaker Cura in their usual install locations and lists only the ones it finds, one entry per slicer:
    • macOS: BambuStudio.app, OrcaSlicer.app, PrusaSlicer.app and UltiMaker Cura.app in /Applications or ~/Applications.
    • Windows: Bambu Studio\bambu-studio.exe, OrcaSlicer\orca-slicer.exe and Prusa3D\PrusaSlicer\prusa-slicer.exe in Program Files or %LOCALAPPDATA%\Programs. For Cura it takes the newest UltiMaker Cura <version>\UltiMaker-Cura.exe. Windows names ignore case, so this also finds the older "Ultimaker Cura 5.x" folders. I checked the Orca and Cura paths against their CPack and NSIS packaging.
    • Linux: bambu-studio, orca-slicer, prusa-slicer and cura on PATH, then the user and system Flatpak exports (com.bambulab.BambuStudio, com.orcaslicer.OrcaSlicer and the older io.github.softfever.OrcaSlicer, com.prusa3d.PrusaSlicer, com.ultimaker.cura).
  • pick_slicer_app opens the native file dialog: app bundles on macOS (starting in /Applications), .exe files on Windows, and any executable on Linux, so AppImages work. Kromacut remembers the picked app in picked-slicers.json in the app config folder, keeping at most 16.
  • open_model_in_slicer accepts an optional X-Kromacut-Slicer-App header. The path is percent-encoded because header values must be ASCII and user paths are often not. It only launches a detected slicer or an app picked in the native dialog. The web view can never name some other program to run, which keeps the "only a 3MF can be written or opened" guarantee from Open the generated 3MF in the default slicer from the desktop app #148. find_slicer_app uses the same rule.
  • How each app is launched:
    • macOS: open -a <app> <model> through the existing checked launcher, so Launch Services errors are reported.
    • Flatpak: flatpak run --file-forwarding <id> @@ <model> @@. The exported launcher doesn't forward files, so the sandboxed slicer couldn't otherwise read Kromacut's cache.
    • Everything else: the app is started with the model as its argument and reaped in the background.

Frontend

  • useSlicerChoice holds the saved preference and the chooser state. SlicerChooserDialog reuses the existing AlertDialog, Switch and radio-list patterns (the list matches the preview-mode menu). slicerPreference.ts stores { kind: 'system' } or { kind: 'app', app: { name, path } } under kromacut:desktop-slicer. It rejects malformed values and keeps working when storage is blocked.
  • useAppHandlers.onOpenInSlicer now takes the chosen slicer. The browser build is unchanged and has no chooser or menu item.

Strings, docs, changelog

  • 18 new strings and an updated Open in Slicer hint in all 12 locales. Each locale uses its existing word for slicer ("logiciel de découpe", "laminador", and so on).
  • The export guide's Open in Slicer paragraph now covers the chooser, presets, Browse, remembering, changing or forgetting, and the missing-slicer fallback, in all 12 languages.
  • Unreleased changelog entry under Added.

Closes #152

Tests

  • Rust (slicer_apps has 8 new tests, slicer_handoff has 1):
    • preset detection on each platform, including the newest Cura version and skipping folders without an executable or without a version
    • Linux PATH commands taking priority over Flatpak
    • rejecting files that can't be launched
    • naming picked apps after their preset or their file name
    • the detected-or-picked launch rule, including a picked app that was later uninstalled
    • de-duplicating and capping the picked-app list
    • launch commands (open -a, Flatpak file forwarding, direct start in the app's folder)
    • percent-decoding of the header, including non-ASCII and invalid UTF-8
  • Rust runs: cargo test passes natively on macOS (29 tests) and on Linux (rust:1-bookworm with the WebKitGTK packages, 26 tests). cargo clippy --all-targets is clean on macOS, Linux and x86_64-pc-windows-msvc (cross-checked), and cargo fmt --check is clean.
  • Unit: tests/slicerPreference.test.ts covers round-trips, forgetting, malformed stored values and blocked storage.
  • e2e (tests/e2e/open-in-slicer.spec.ts, @smoke):
    • The existing desktop test now goes through the chooser: the first click asks, nothing is installed, so the "none found" hint shows and System default is selected.
    • A new test covers cancelling, picking a detected slicer and remembering it, the header carrying the encoded path, the menu naming the slicer, opening without asking, reopening through Choose Slicer, a rejected Browse pick showing an error, a browsed non-ASCII path, forgetting by switching remember off, and remembering System default (no slicer header).
    • Another new test seeds a saved slicer that is no longer installed. It checks the chooser explains this, the preference is cleared, and nothing is exported.
  • Full run in the CI Playwright image (v1.60.0-noble): npm run lint, npx tsc -b, npm run check:i18n, npm test (1138 pass, 1 skipped), npm run test:i18n, npm run test:docs, npm run check:e2e, and npm run test:e2e:all. All 8 suites passed, 96 @smoke tests among them.
  • Not tried by hand: I couldn't run a packaged desktop build here, so a real slicer launch hasn't been tested on Windows, macOS or Linux. The native dialog's .app filter on macOS hasn't been seen in a real build either.

Open in Slicer (vycdev#148) always handed the 3MF to the operating system's
default .3mf app, so anyone whose default was a 3D viewer, or who uses
more than one slicer, had to change OS file associations first. This
adds the slicer choice that vycdev#69 asked for and vycdev#148 left out.

Native side (src-tauri/src/slicer_apps.rs):
- list_slicer_apps detects Bambu Studio, Orca Slicer, PrusaSlicer and
  UltiMaker Cura in their usual locations: /Applications and
  ~/Applications on macOS; Program Files and %LOCALAPPDATA%\Programs on
  Windows (the newest "UltiMaker Cura <version>" folder wins, and the
  case-insensitive match also finds the older "Ultimaker Cura" folders);
  PATH commands and user/system Flatpak exports on Linux. Only
  installed slicers are listed, one entry per slicer.
- pick_slicer_app opens the native file dialog (app bundles on macOS,
  .exe on Windows, any executable on Linux) and remembers the picked
  app in picked-slicers.json in the app config directory (at most 16).
- open_model_in_slicer takes an optional, percent-encoded
  X-Kromacut-Slicer-App header. A model is only launched with a
  detected slicer or a picked app, never with an arbitrary program
  named by the web view; find_slicer_app applies the same rule.
- macOS launches with `open -a <app> <model>` through the existing
  checked launcher, so Launch Services failures are reported. Flatpak
  slicers run through `flatpak run --file-forwarding`, because the
  exported launcher would not let the sandbox read Kromacut's cache.
  Other apps are spawned with the model as their argument and reaped
  in the background.

Frontend:
- Open in Slicer shows a chooser before building the 3MF: System
  default (the previous behavior), the detected slicers, and Browse.
  "Always use this slicer" saves the choice under
  kromacut:desktop-slicer; the menu item then names the slicer
  ("Open in Orca Slicer") and a new Choose Slicer item changes or
  forgets it. Turning the switch off and opening clears the choice.
- A saved slicer that was moved or uninstalled is forgotten and the
  chooser explains that it could not be found.
- Launch failures keep the localized error from b2873f4.
- useSlicerChoice owns the saved preference and the chooser state;
  SlicerChooserDialog uses the existing AlertDialog, Switch and
  radio-list patterns. slicerPreference.ts validates stored values and
  tolerates blocked storage.

Strings, docs and changelog:
- New chooser and menu strings in all 12 locales, using each locale's
  existing slicer term. The Open in Slicer hint no longer promises the
  default 3MF app.
- The export guide's Open in Slicer paragraph describes the chooser in
  all 12 languages.
- Unreleased changelog entry under Added.

Tests:
- Native: detection per platform, newest Cura version, rejecting
  folders without an executable, launchable-app validation, describing
  picked apps, the detected-or-picked launch rule, picked-app storage
  and cap, launch commands (open -a, Flatpak file forwarding, direct),
  and percent-decoding of the slicer header.
- Unit: saving, loading, forgetting and rejecting malformed stored
  preferences, and blocked storage.
- e2e: the first click asks; choosing, remembering, changing, browsing
  (including a rejected pick), forgetting, remembering the system
  default, and a missing saved slicer.

Fixes vycdev#152
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T22:04:00.724911Z
We couldn’t complete this review. Comment @codex review to try again.
53c46f2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@vycdev

vycdev commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Verified before merge on macOS at 53c46f2:

  • cargo fmt --check, cargo clippy --all-targets -D warnings, and cargo test (29 pass).
  • A throwaway test (not committed) ran open_with_slicer_app against a fake .app bundle at a non-ASCII path. It was refused before being recorded as picked, and launched through open -a afterwards.
  • lint, tsc -b, check:i18n, test:docs, test:i18n, npm test (1138 pass), and the Open in Slicer @smoke e2e specs all pass.
  • I clicked through every chooser state in the web build with the desktop IPC faked, in all 12 locales and both themes.

Not covered: the native Browse dialog and a real slicer launch inside a packaged build.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants