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
480e99a926
commit
f9c770d8cf
@@ -6,7 +6,7 @@ import { homedir, tmpdir } from "node:os"
|
|||||||
import { join } from "node:path"
|
import { join } from "node:path"
|
||||||
import { getCACertificates, setDefaultCACertificates } from "node:tls"
|
import { getCACertificates, setDefaultCACertificates } from "node:tls"
|
||||||
import type { Event } from "electron"
|
import type { Event } from "electron"
|
||||||
import { app } from "electron"
|
import { app, BrowserWindow } from "electron"
|
||||||
|
|
||||||
import { Deferred, Effect, Fiber } from "effect"
|
import { Deferred, Effect, Fiber } from "effect"
|
||||||
import contextMenu from "electron-context-menu"
|
import contextMenu from "electron-context-menu"
|
||||||
@@ -408,6 +408,15 @@ const main = Effect.gen(function* () {
|
|||||||
|
|
||||||
yield* Fiber.await(loadingTask)
|
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()
|
const windows = restoreMainWindows()
|
||||||
if (windows.length) createMenu(menuDeps)
|
if (windows.length) createMenu(menuDeps)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user