mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 14:46:04 +02:00
fix: tray icon cannot be destroyed when app restart or exit in linux
This commit is contained in:
@@ -216,6 +216,7 @@ ipcMain.handle('app:restart', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
app.relaunch(options);
|
app.relaunch(options);
|
||||||
|
destroyTray();
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
} else {
|
} else {
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
@@ -292,6 +293,7 @@ function tryRelaunchWithArgs(args) {
|
|||||||
|
|
||||||
child.unref();
|
child.unref();
|
||||||
|
|
||||||
|
destroyTray();
|
||||||
app.exit(0);
|
app.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,6 +480,12 @@ function writeOverlayFrame(imageBuffer) {
|
|||||||
let tray = null;
|
let tray = null;
|
||||||
let trayIcon = null;
|
let trayIcon = null;
|
||||||
let trayIconNotify = null;
|
let trayIconNotify = null;
|
||||||
|
function destroyTray() {
|
||||||
|
if (tray) {
|
||||||
|
tray.destroy();
|
||||||
|
tray = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
function createTray() {
|
function createTray() {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
const image = nativeImage.createFromPath(
|
const image = nativeImage.createFromPath(
|
||||||
@@ -915,10 +923,7 @@ app.on('before-quit', function () {
|
|||||||
// Mark it as a quitting state to make macOS Dock's "Quit" action take effect.
|
// Mark it as a quitting state to make macOS Dock's "Quit" action take effect.
|
||||||
appIsQuitting = true;
|
appIsQuitting = true;
|
||||||
disposeOverlay();
|
disposeOverlay();
|
||||||
if (tray) {
|
destroyTray();
|
||||||
tray.destroy();
|
|
||||||
tray = null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('window-all-closed', function () {
|
app.on('window-all-closed', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user