diff --git a/js/main-window.js b/js/main-window.js index 40a7fb20d..1fd0f03ae 100644 --- a/js/main-window.js +++ b/js/main-window.js @@ -106,16 +106,20 @@ function createWindow() tray.popUpContextMenu(contextMenu); }); - mainWindow.on('minimize', () => + mainWindow.on('minimize', (event) => { - event.preventDefault(); - mainWindow.hide(); + const savedPreferences = getUserPreferences(); + if (savedPreferences['minimize-to-tray']) + { + event.preventDefault(); + mainWindow.hide(); + } }); // Emitted when the window is closed. mainWindow.on('close', (event) => { - let savedPreferences = getUserPreferences(); + const savedPreferences = getUserPreferences(); if (!app.isQuitting && savedPreferences['close-to-tray']) { event.preventDefault(); @@ -133,4 +137,4 @@ function createWindow() module.exports = { createWindow, getMainWindow -}; \ No newline at end of file +}; diff --git a/js/user-preferences.js b/js/user-preferences.js index a936b5116..e0693a6ae 100644 --- a/js/user-preferences.js +++ b/js/user-preferences.js @@ -9,6 +9,7 @@ const { isValidTheme } = require('./themes.js'); const defaultPreferences = { 'count-today': false, 'close-to-tray': true, + 'minimize-to-tray': true, 'hide-non-working-days': false, 'hours-per-day': '08:00', 'notification': true, @@ -33,6 +34,7 @@ const defaultPreferences = { const booleanInputs = [ 'count-today', 'close-to-tray', + 'minimize-to-tray', 'hide-non-working-days', 'notification', 'repetition', diff --git a/src/preferences.html b/src/preferences.html index 4317b7b0b..2f730f808 100644 --- a/src/preferences.html +++ b/src/preferences.html @@ -74,6 +74,10 @@

Overall Balance Start Date

+
+

Minimize button should minimize to tray

+ +

Close button should minimize to tray