Skip to content

Disable multi-window mode - #3188

Closed
tichise wants to merge 1 commit into
manaflow-ai:mainfrom
tichise:disable-multi-window
Closed

tichise wants to merge 1 commit into
manaflow-ai:mainfrom
tichise:disable-multi-window

Conversation

@tichise

@tichise tichise commented Apr 27, 2026 •

Copy link
Copy Markdown

No description provided.

Users could spawn multiple main windows via File > New Window, the Dock
menu, the Finder service "New cmux Window Here", session restore, and
the workspace context menu's "Move to Window > New Window". Each
window had its own independent TabManager / SidebarState / FileExplorer
state, so workspaces, surfaces, and focus were not synchronized between
windows and the focus-routing code (`setActiveMainWindow`,
`synchronizeActiveMainWindowContext`) could only paper over a subset of
the resulting state divergence.

Drop multi-window support entirely:

- Remove the `New Window` File menu item and the Dock menu (which only
  contained `New Window`).
- Make `openNewMainWindow` reuse the existing window via
  `ensureInitialMainWindowIfNeeded` so any leftover entry point that
  still calls it (workspace fallback, etc.) just brings the existing
  window forward.
- Route the Finder service `openWindow` action through the same
  workspace path as `openTab`.
- Remove the workspace context menu's `Move Workspace to Window`
  submenu and its supporting helpers.
- Trim session restore (both startup and `reopenPreviousSession`) to a
  single window so legacy snapshots with multiple windows don't
  resurrect them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 27, 2026

Copy link
Copy Markdown

@tichise is attempting to deploy a commit to the Manaflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Apr 27, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Startup and session restoration behavior has been changed to single-window-only mode: additional persisted windows are no longer restored during initial startup, and window creation through UI entry points has been adjusted. Multi-window workspace relocation features have been removed from the application menu in cmuxApp.swift, along with their supporting helper methods.

Changes

Cohort / File(s) Summary
Single-window startup behavior
Sources/AppDelegate.swift
Modified session restoration to limit restored windows to one, adjusted applicationDockMenu to return nil, ensured initial window via ensureInitialMainWindowIfNeeded(), and consolidated service-open handling to use openWorkspaceFromService for both .window and .workspace pasteboard targets.
Multi-window menu removal
Sources/cmuxApp.swift
Removed "New Window" menu entry from .newItem command group, deleted entire "Move Workspace to Window" submenu (including "Move to New Window" and enumerated window targets), and removed supporting helper methods for computing move targets and invoking workspace relocation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 One window now, the startup sings,
No more the many-windowed things,
The menus slim, the helpers gone,
A simpler path to carry on! 🎪

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the summary and test plan requirements but lacks explicit information on how the change was tested and a demo video link. Add details on local testing results and include a demo video link or note if none was recorded. Also confirm all checklist items have been completed before merging.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Disable multi-window mode' accurately summarizes the main change: converting the application from multi-window to single-window operation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tichise tichise closed this Apr 27, 2026
@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR disables multi-window mode by removing the New Window menu/Dock entry, capping session restore to a single window, routing the Finder openWindow service to openWorkspaceFromService, and deleting the "Move Workspace to Window" submenu and its helpers.

The implementation is clean and internally consistent. reopenPreviousSession correctly preserves the existingContexts.isEmpty path (lines 2348-2354) so a manual session reopen with no live window still creates one; the removed snapshotWindows.count > existingContexts.count branch in the else arm was unreachable once prefix(1) is applied with a single existing context.

Confidence Score: 5/5

Safe to merge — all multi-window entry points are cleanly closed with no dangling references or missed completion calls.

No logic bugs found. Session restore correctly handles both the startup path and the manual reopen path. The removed branch (snapshotWindows.count > existingContexts.count inside the else arm) was already unreachable once prefix(1) is applied. Helper removals leave no orphaned call sites.

No files require special attention.

Important Files Changed

Filename Overview
Sources/AppDelegate.swift Session restore capped to 1 window (startup + manual reopen); Dock menu returns nil; openNewMainWindow delegates to ensureInitialMainWindowIfNeeded; Finder .window case unified with .workspace — all changes are correct and consistent.
Sources/cmuxApp.swift Removed 'New Window' File menu item, 'Move Workspace to Window' context menu, and three associated helpers; windowMoveTargets local variable cleaned up — straightforward removal with no dangling references.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App Launch / Reopen] --> B{startupSnapshot != nil?}
    B -- No --> C[No session restore]
    B -- Yes --> D[Apply primary window snapshot only]
    D --> E[completeSessionRestoreOperation\nisManualReopen: false]

    F[reopenPreviousSession] --> G[Load snapshot\nprefix 1 window]
    G --> H{existingContexts\nempty?}
    H -- Yes --> I[createMainWindow\nwith snapshot]
    H -- No --> J[applySessionWindowSnapshot\nto existing window]
    J --> K{Too many live windows?}
    K -- Yes --> L[closeMainWindow\nfor extras]
    K -- No --> M[Done]
    I --> M
    L --> M
    M --> N[completeSessionRestoreOperation\nisManualReopen: true]

    O[File Menu / Dock / Finder] --> P{Action}
    P -- New Window removed --> Q[⌘N → New Workspace only]
    P -- Dock menu --> R[nil — no custom items]
    P -- Finder openWindow --> S[openWorkspaceFromService\nin existing window]
    P -- openNewMainWindow --> T[ensureInitialMainWindowIfNeeded\nbring existing window to front]
Loading

Reviews (1): Last reviewed commit: "Disable multi-window mode" | Re-trigger Greptile

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.

1 participant