Skip to content

Support multiple windows#73

Merged
danipen merged 4 commits into
mainfrom
multiple-windows
Jul 4, 2026
Merged

Support multiple windows#73
danipen merged 4 commits into
mainfrom
multiple-windows

Conversation

@danipen

@danipen danipen commented Jul 4, 2026

Copy link
Copy Markdown
Owner

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

  • New WindowManager (src/main/windows.ts) owns all BrowserWindow lifecycle 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).
  • File ▸ New Window (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.
  • Additional windows cascade down-right from the focused one; the first window restores last session's geometry.
  • The application menu is rebuilt on focus/repo changes so its Repository actions always target the window you're looking at.
  • Op progress goes back to the window that started the op (not broadcast); repo-change pings broadcast to all windows, each renderer refreshing only for its own repo.
  • Window title tracks the open repo, and theme changes propagate across windows via the storage event.

Session restore

  • New session-store.ts persists 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)

  • macOS: recents ride the OS recent-documents list (rendered in the Dock icon menu even while closed); custom Dock menu adds "New Window".
  • Windows: Jump List with recent repositories + "New Window", rebuilt whenever recents change; adopts the installer's AppUserModelID so the taskbar groups windows under the shortcut. New installer.nsh adds an Explorer folder context-menu entry ("Open in GitGrove").
  • Linux: static [Desktop Action] "New Window" in the .desktop file.
  • All launcher entries relaunch with --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 test green (includes new session-store.test.ts and expanded window-state/cli tests).
  • Manual: multiple windows, New Window, Open in New Window, session restore on relaunch, Dock/Jump List/Explorer/desktop-action shortcuts per platform.

danipen added 4 commits July 4, 2026 09:12
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.
@danipen danipen merged commit 7176586 into main Jul 4, 2026
9 checks passed
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