Skip to content

Open workbooks in separate native windows - #171

Open
Zarvinx wants to merge 7 commits into
storytold:mainfrom
Zarvinx:fix-file-drop-workbook-switcher
Open

Zarvinx wants to merge 7 commits into
storytold:mainfrom
Zarvinx:fix-file-drop-workbook-switcher

Conversation

@Zarvinx

@Zarvinx Zarvinx commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Note

This overlaps with #496 in close/quit handling. Whichever lands second will need to rebase and reconcile that flow.

The egui state groundwork is also available independently in #662. Both branches now share the exact rebased f79bf61 commit, so either PR can merge first without creating a stacked dependency.

Summary

  • open each desktop workbook in its own native window instead of switching documents inside one window
  • keep the title-bar workbook selector as a quick way to focus or close another workbook window
  • preserve workbook state and undo history when moving a newly opened document into its window
  • route Finder/Dock open requests to an existing matching window, an untouched front blank, or a new window
  • keep theme, language, preferences, and recent files synchronized across workbook windows
  • isolate editor, dialog, pane, and overlay state per workbook window
  • keep dirty workbooks open behind the existing save-changes prompt
  • show unsaved state in dark yellow in both light and dark themes

Desktop behavior

  • Opening, dropping, or creating another workbook gives it a separate window.
  • Closing one window leaves the other workbook windows open.
  • Closing the original eframe root window promotes another workbook window while preserving its position and size.
  • The native menu and local control channel follow the focused workbook.
  • Blank workbook titles remain unique across windows.

The web app keeps its existing in-session document switching behavior.

Verification

  • cargo fmt --all -- --check
  • cargo test -p gridcraft (35 passed, including the macOS native-menu harness)
  • cargo test -p gridcraft-ui-egui --test interaction (37 passed)
  • cargo test -p gridcraft-ui-egui --test formula_popup (6 passed)
  • cargo test -p gridcraft-ui-egui --test keyboard_shortcuts (8 passed)
  • cargo test -p gridcraft-ui-egui --test workbook_widget_state (1 passed)
  • chart resizing, committed text-field, and contributor UI tests
  • branch-specific Clippy checks pass with the unrelated latest-main XLS lint allowed
  • cargo xtask wasm
  • cargo xtask assets
  • cargo xtask layers
  • cargo xtask parity --check
  • cargo xtask keytips --check
  • macOS native test with two CSV windows
  • verified new-workbook creation, per-workbook close, existing-file focus, and dirty-close cancellation through the desktop control channel

The full cargo xtask ci run currently stops on Rust 1.95 Clippy warnings in untouched latest-main XLS code. A full workspace test run also reaches unrelated existing failures in CSV number formatting, one missing French translation, and the sandboxed MCP TCP test; the changed app and UI tests pass.

Fixes #162

@prxnvt

prxnvt commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Thank you for this. I worked on the same area in a fork and ran into a few multi-window cases that may be useful to check here. They come from my branch, so some may already be handled in this one:

  1. Opening from Finder, the Dock and open -a (the Apple Events handling from macOS: open documents from Finder, the Dock and open -a (#69) #164): the file should go to the window that already has it, or to the front window if that window holds only an untouched blank workbook, and otherwise to a new window.
  2. Theme and language across windows. With one shared egui context, windows whose theme or language differed drew garbled text. Making both app-wide fixed it.
  3. Per-window widget state. Editors, dialogs and panes that use fixed egui ids shared cursor and layout state between windows (for example the formula bar height). Salting those ids per window fixed it.
  4. Preferences and recent files changed in a second window were lost on exit when only the first window's state was saved.
  5. Quitting with several dirty windows. Choosing Don't Save in one window and then Cancel in the next must not leave the first window closable without asking.

#496 (closing the window or quitting asks to save unsaved workbooks) also changes close handling, so the two would need to be reconciled if both merge.

@Zarvinx
Zarvinx marked this pull request as draft October 12, 2026 08:39
@Zarvinx

Zarvinx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed write-up! These all look relevant. I've moved this back to draft and marked it as blocked by #496 rather than building a competing close/quit flow.

I'll rebase onto the latest main and work through the other points now: Apple Event routing and blank-window reuse, app-wide theme/language and preferences/recent files, and per-window egui state. Once #496 lands, I'll rebase again and adapt the multi-window close/quit path on top of it.

This branch has not been deployed

No deployments
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.

[Desktop] Open each workbook in its own native window

2 participants