fix(desktop): preserve macOS app on window close (#40974)

Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot] 2026-08-07 07:25:12 +00:00 committed by GitHub
parent 1ec6bdc8c6
commit b467518dae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ import { homedir, tmpdir } from "node:os"
import { join } from "node:path"
import { getCACertificates, setDefaultCACertificates } from "node:tls"
import type { Event } from "electron"
import { app } from "electron"
import { app, BrowserWindow } from "electron"
import { Deferred, Effect, Fiber } from "effect"
import contextMenu from "electron-context-menu"
@ -408,6 +408,15 @@ const main = Effect.gen(function* () {
yield* Fiber.await(loadingTask)
app.on("window-all-closed", () => {
if (process.platform === "darwin") return
app.quit()
})
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length > 0) return
restoreMainWindows()
})
const windows = restoreMainWindows()
if (windows.length) createMenu(menuDeps)
})