Skip to content

Commit b39bd55

Browse files
committed
fix tray multiness problem
1 parent 084450c commit b39bd55

File tree

2 files changed

+2495
-3829
lines changed

2 files changed

+2495
-3829
lines changed

main.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ app.on('ready', () => {
399399
hasGotSingleInstanceLock = app.requestSingleInstanceLock();
400400
if (!hasGotSingleInstanceLock) {
401401
console.log('Didn\'t get the lock, quitting');
402-
app.quit();
402+
app.exit();
403403
} else {
404404
app.on('second-instance', () => {
405405
if (win != null) {
@@ -567,19 +567,21 @@ app.on('ready', () => {
567567
}
568568
}
569569

570-
if (process.platform === "win32") tray = new Tray(path.join(__dirname, '\\res\\icons\\iconWin.ico'));
571-
else if (process.platform === "darwin") tray = new Tray(path.join(__dirname, '/res/icons/trayIconMacTemplate.png'));
572-
else if (process.platform === "linux") tray = new Tray(path.join(__dirname, '/res/icons/wnrIcon.png'));
573-
try {
574-
tray.setToolTip('wnr');
575-
} catch (e) {
576-
console.log(e);
570+
if (app.requestSingleInstanceLock()) {
571+
if (process.platform === "win32") tray = new Tray(path.join(__dirname, '\\res\\icons\\iconWin.ico'));
572+
else if (process.platform === "darwin") tray = new Tray(path.join(__dirname, '/res/icons/trayIconMacTemplate.png'));
573+
else if (process.platform === "linux") tray = new Tray(path.join(__dirname, '/res/icons/wnrIcon.png'));
574+
try {
575+
tray.setToolTip('wnr');
576+
} catch (e) {
577+
console.log(e);
578+
}
579+
traySolution(false);
580+
isFullscreenMode = false;
581+
macOSFullscreenSolution(false);
582+
isDarkMode();
583+
settingsWinContextMenuSolution();
577584
}
578-
traySolution(false);
579-
isFullscreenMode = false;
580-
macOSFullscreenSolution(false);
581-
isDarkMode();
582-
settingsWinContextMenuSolution();
583585

584586
if (store.get("tray-time") !== false && process.platform === "darwin")
585587
tray.setTitle(' ' + i18n.__('not-timing-tray'));

0 commit comments

Comments
 (0)