Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fixing not working tray menu

Ilian Sapundshiev0d92840f40ef
diff --git a/app/services/electron-io.js b/app/services/electron-io.js
index 8950ed319..08f195a15 100644
--- a/app/services/electron-io.js
+++ b/app/services/electron-io.js
@@ -44,6 +44,7 @@ export default class ElectronIO {
fs: Object;
fsWatcher: Object;
webFrame: Object;
+ tsTray: Object;
constructor() {
if (window.require) {
@@ -103,16 +104,19 @@ export default class ElectronIO {
nImage = nativeImage.createFromDataURL(TrayIcon2x);
}
- const tsTray = new Tray(nImage);
+ if (this.tsTray && this.tsTray.destroy) {
+ this.tsTray.destroy();
+ }
+ this.tsTray = new Tray(nImage);
- tsTray.on('click', () => {
+ this.tsTray.on('click', () => {
if (mainWindow) {
mainWindow.show();
}
});
const trayMenu = Menu.buildFromTemplate(menuConfig);
- tsTray.setToolTip('TagSpaces');
- tsTray.setContextMenu(trayMenu);
+ this.tsTray.setToolTip('TagSpaces');
+ this.tsTray.setContextMenu(trayMenu);
};
isWorkerAvailable = (): boolean => {
diff --git a/app/services/electron-tray-menu.js b/app/services/electron-tray-menu.js
index 96c378464..3e7de714b 100644
--- a/app/services/electron-tray-menu.js
+++ b/app/services/electron-tray-menu.js
@@ -81,7 +81,6 @@ export default function buildTrayIconMenu(mainPageProps: Object) {
},
{
label: i18n.t('core:quitTagSpaces') + cKey + '+Q',
- // role: 'quit',
click: PlatformIO.quitApp
}
];