|
@@ -5,11 +5,12 @@ const tray = {};
|
|
|
|
|
|
tray.openApp = function () {
|
|
|
if (appIcon) {
|
|
|
+ // Set tray inactive
|
|
|
+ trayInactive = true;
|
|
|
+ // Remove tray
|
|
|
appIcon.destroy();
|
|
|
// Re create the main window on dashboard page and close the invisible window
|
|
|
- const newWindow = window.new(path.join(__dirname, '../../renderer/page/dashboard/dashboard.html'));
|
|
|
- mainWindow.close();
|
|
|
- mainWindow = newWindow;
|
|
|
+ mainWindow = window.new(path.join(__dirname, '../../renderer/page/dashboard/dashboard.html'));
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -21,13 +22,15 @@ tray.closeApp = function () {
|
|
|
}
|
|
|
|
|
|
tray.active = function () {
|
|
|
+ // Set tray active
|
|
|
+ trayInactive = false;
|
|
|
+ // Create tray
|
|
|
appIcon = new Tray(path.join(__dirname, '../asset/tray.png'));
|
|
|
appIcon.setToolTip('Electronotes');
|
|
|
appIcon.setContextMenu(menu);
|
|
|
// Hide app
|
|
|
- const invisibleWindow = window.hidden(); // Create invisible window to avoid closing the app when all window are closed
|
|
|
mainWindow.close();
|
|
|
- mainWindow = invisibleWindow;
|
|
|
+ mainWindow = null;
|
|
|
// Left click => open app
|
|
|
appIcon.on('click', (event) => {
|
|
|
tray.openApp();
|