#16 Added minimize to tray on startup ability.

This commit is contained in:
Quentin Decaunes 2019-06-01 15:55:19 +02:00
parent 387dc7c5d8
commit 323f141316
2 changed files with 13 additions and 1 deletions

View File

@ -129,6 +129,7 @@ function preFillSettings() {
// document.getElementById('start_at_boot').checked = !!settings.get('settings.start_at_boot'); // document.getElementById('start_at_boot').checked = !!settings.get('settings.start_at_boot');
document.getElementById('apply_last_settings_on_launch').checked = !!settings.get('settings.apply_last_settings_on_launch'); document.getElementById('apply_last_settings_on_launch').checked = !!settings.get('settings.apply_last_settings_on_launch');
document.getElementById('minimize_to_tray').checked = !!settings.get('settings.minimize_to_tray'); document.getElementById('minimize_to_tray').checked = !!settings.get('settings.minimize_to_tray');
document.getElementById('start_minimized').checked = !!settings.get('settings.start_minimized');
seconds = parseInt(settings.get('settings.reapply_periodically')); seconds = parseInt(settings.get('settings.reapply_periodically'));
seconds = seconds >= 0 ? seconds : 0; seconds = seconds >= 0 ? seconds : 0;
@ -260,6 +261,13 @@ function registerEventListenerForSettingsInput() {
minimize_to_tray: !!minimize_to_tray.checked minimize_to_tray: !!minimize_to_tray.checked
}); });
}); });
var start_minimized = document.getElementById('start_minimized');
start_minimized.addEventListener('change', function() {
settings.set('settings', {
...settings.get('settings'),
start_minimized: !!start_minimized.checked
});
});
var reapply_periodically = document.getElementById('reapply_periodically'); var reapply_periodically = document.getElementById('reapply_periodically');
reapply_periodically.addEventListener('change', function() { reapply_periodically.addEventListener('change', function() {
reApplyPeriodically(reapply_periodically.value); reApplyPeriodically(reapply_periodically.value);

View File

@ -113,8 +113,12 @@ function createWindow () {
webPreferences: { webPreferences: {
nodeIntegration: true nodeIntegration: true
}, },
icon: appIcon icon: appIcon,
show: false,
}) })
if (!settings.get('settings.start_minimized')) {
mainWindow.show();
}
mainWindow.setOpacity(0.95); mainWindow.setOpacity(0.95);