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:
committed by
GitHub
parent
1ec6bdc8c6
commit
b467518dae
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user