mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-08 19:53:21 +00:00
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:
parent
1ec6bdc8c6
commit
b467518dae
1 changed files with 10 additions and 1 deletions
|
|
@ -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)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue