Support multiple windows#73
Merged
Merged
Conversation
The session parse/validation lived in session-store.ts alongside the electron file I/O, so importing it from the unit test dragged in electron — which bun can't load, failing the whole suite (and CI lint tripped on formatting). Split the pure logic into session.ts (mirroring window-state.ts vs window-state-store.ts); session-store.ts keeps the file I/O.
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.
Summary
Turns GitGrove from a single-window app into a proper multi-window one, all inside a single main process (single-instance lock), so the per-repo write queue, the recents store, the window-state file and the accounts cipher keep exactly one writer no matter how many windows are open. The app now reopens exactly where you left off, and the OS launcher surfaces (Dock menu, Windows Jump List, Explorer context menu, Linux desktop action) know about your recent repos.
What's new
Multiple windows
WindowManager(src/main/windows.ts) owns allBrowserWindowlifecycle and per-window state: which repo each window has open, the repo a new window should boot into, and the last-focused window (so menu actions/credential prompts have a target even in the background).Cmd/Ctrl+N) opens a welcome-screen window; "Open in New Window" in the repo switcher opens a second repo side by side without touching the current window.storageevent.Session restore
session-store.tspersists the open windows (one entry per window, repo path or welcome-screen marker); relaunch reopens each window on its repo. Saving stops the moment quitting begins so the close cascade can't wipe the session.OS launcher integration (
app-shortcuts.ts)installer.nshadds an Explorer folder context-menu entry ("Open in GitGrove").[Desktop Action]"New Window" in the.desktopfile.--repo <path>/--new-window; the single-instance lock routes them into the running instance, which focuses the window already showing the repo, reuses a welcome-screen window, or opens a fresh one.Watcher now reconciles its watched set against the repos open across all windows (
sync), so no fs events/inotify watches are spent on repos nobody is looking at.Test plan
bun run lint,bun run typecheck,bun testgreen (includes newsession-store.test.tsand expandedwindow-state/clitests).