|
|
|
|
@ -9,7 +9,15 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
@@ -9,7 +9,15 @@ import { LogService } from "@bitwarden/common/platform/abstractions/log.service"
|
|
|
|
|
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; |
|
|
|
|
import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service"; |
|
|
|
|
|
|
|
|
|
import { cleanUserAgent, isDev, isMacAppStore, isSnapStore } from "../utils"; |
|
|
|
|
import { |
|
|
|
|
cleanUserAgent, |
|
|
|
|
isDev, |
|
|
|
|
isLinux, |
|
|
|
|
isMac, |
|
|
|
|
isMacAppStore, |
|
|
|
|
isSnapStore, |
|
|
|
|
isWindows, |
|
|
|
|
} from "../utils"; |
|
|
|
|
|
|
|
|
|
const mainWindowSizeKey = "mainWindowSize"; |
|
|
|
|
const WindowEventHandlingDelay = 100; |
|
|
|
|
@ -41,9 +49,12 @@ export class WindowMain {
@@ -41,9 +49,12 @@ export class WindowMain {
|
|
|
|
|
// User might have changed theme, ensure the window is updated.
|
|
|
|
|
this.win.setBackgroundColor(await this.getBackgroundColor()); |
|
|
|
|
|
|
|
|
|
const crashEvent = once(this.win.webContents, "render-process-gone"); |
|
|
|
|
this.win.webContents.forcefullyCrashRenderer(); |
|
|
|
|
await crashEvent; |
|
|
|
|
// By default some linux distro collect core dumps on crashes which gets written to disk.
|
|
|
|
|
if (!isLinux()) { |
|
|
|
|
const crashEvent = once(this.win.webContents, "render-process-gone"); |
|
|
|
|
this.win.webContents.forcefullyCrashRenderer(); |
|
|
|
|
await crashEvent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.win.webContents.reloadIgnoringCache(); |
|
|
|
|
this.session.clearCache(); |
|
|
|
|
@ -66,7 +77,7 @@ export class WindowMain {
@@ -66,7 +77,7 @@ export class WindowMain {
|
|
|
|
|
} |
|
|
|
|
this.win.focus(); |
|
|
|
|
} |
|
|
|
|
if (process.platform === "win32" || process.platform === "linux") { |
|
|
|
|
if (isWindows() || isLinux()) { |
|
|
|
|
if (this.argvCallback != null) { |
|
|
|
|
this.argvCallback(argv); |
|
|
|
|
} |
|
|
|
|
@ -96,7 +107,7 @@ export class WindowMain {
@@ -96,7 +107,7 @@ export class WindowMain {
|
|
|
|
|
app.on("window-all-closed", () => { |
|
|
|
|
// On OS X it is common for applications and their menu bar
|
|
|
|
|
// to stay active until the user quits explicitly with Cmd + Q
|
|
|
|
|
if (process.platform !== "darwin" || this.isQuitting || isMacAppStore()) { |
|
|
|
|
if (!isMac() || this.isQuitting || isMacAppStore()) { |
|
|
|
|
app.quit(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -137,8 +148,8 @@ export class WindowMain {
@@ -137,8 +148,8 @@ export class WindowMain {
|
|
|
|
|
x: this.windowStates[mainWindowSizeKey].x, |
|
|
|
|
y: this.windowStates[mainWindowSizeKey].y, |
|
|
|
|
title: app.name, |
|
|
|
|
icon: process.platform === "linux" ? path.join(__dirname, "/images/icon.png") : undefined, |
|
|
|
|
titleBarStyle: process.platform === "darwin" ? "hiddenInset" : undefined, |
|
|
|
|
icon: isLinux() ? path.join(__dirname, "/images/icon.png") : undefined, |
|
|
|
|
titleBarStyle: isMac() ? "hiddenInset" : undefined, |
|
|
|
|
show: false, |
|
|
|
|
backgroundColor: await this.getBackgroundColor(), |
|
|
|
|
alwaysOnTop: this.enableAlwaysOnTop, |
|
|
|
|
|