1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

handle quit app action from tray menu

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2020-10-12 18:54:31 +03:00
parent 5c9db14f4b
commit 1b38e6cda6
3 changed files with 12 additions and 10 deletions

View File

@ -91,9 +91,6 @@ app.on("will-quit", (event) => {
if (userStore.preferences.trayEnabled) {
return; // with tray the app remains open
} else {
windowManager?.destroy();
clusterManager?.stop();
proxyServer?.close();
app.exit(); // forced app.quit()
}
})

View File

@ -78,14 +78,12 @@ export function buildMenu(windowManager: WindowManager) {
{ role: 'unhide' },
{ type: 'separator' },
{
label: 'Force Quit',
accelerator: 'Cmd+Shift+Q',
label: 'Quit',
accelerator: 'Cmd+Q',
click() {
app.exit(0); // force quit since might be blocked within app.on("will-quit")
app.exit(); // force quit since might be blocked within app.on("will-quit")
}
},
{ type: 'separator' },
{ role: 'quit' },
}
]
};

View File

@ -2,7 +2,7 @@ import path from "path"
import sharp from "sharp";
import jsdom from "jsdom"
import packageInfo from "../../package.json"
import { dialog, Menu, NativeImage, nativeImage, nativeTheme, Tray } from "electron"
import { app, dialog, Menu, NativeImage, nativeImage, nativeTheme, Tray } from "electron"
import { isDevelopment, isMac } from "../common/vars";
import { autorun } from "mobx";
import { showAbout } from "./menu";
@ -131,5 +131,12 @@ export function createTrayMenu(windowManager: WindowManager): Menu {
}
},
},
{ type: 'separator' },
{
label: 'Quit App',
click() {
app.exit();
}
}
]);
}