Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to minimize to tray #394

Merged
merged 3 commits into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions js/main-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,14 @@ function createWindow()
tray.popUpContextMenu(contextMenu);
});

mainWindow.on('minimize', () =>
mainWindow.on('minimize', (event) =>
{
event.preventDefault();
mainWindow.hide();
let savedPreferences = getUserPreferences();
thamara marked this conversation as resolved.
Show resolved Hide resolved
if (savedPreferences['minimize-to-tray'])
{
event.preventDefault();
mainWindow.hide();
}
});

// Emitted when the window is closed.
Expand All @@ -124,4 +128,4 @@ function createWindow()

module.exports = {
createWindow
};
};
michaelknowles marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions js/user-preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -114,6 +115,7 @@ function initPreferencesFileIfNotExistsOrInvalid() {
// Handle Boolean Inputs
case 'count-today':
case 'close-to-tray':
case 'minimize-to-tray':
case 'hide-non-working-days':
case 'notification':
case 'repetition':
Expand Down
4 changes: 4 additions & 0 deletions src/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<p>Overall Balance Start Date</p>
<label id='overall-balance-start-date'><input type="date" name="overall-balance-start-date"></label>
</div>
<div class="flex-box">
<p>Minimize button should minimize to tray</p>
<label id='minimize-to-tray' class="switch"><input type="checkbox" name="minimize-to-tray"><span class="slider round"></span></label>
</div>
<div class="flex-box">
<p>Close button should minimize to tray</p>
<label id='close-to-tray' class="switch"><input type="checkbox" name="close-to-tray"><span class="slider round"></span></label>
Expand Down