diff --git a/index.html b/index.html
index 37dfc70..2f15597 100644
--- a/index.html
+++ b/index.html
@@ -70,6 +70,8 @@
+ Auto start with system:
+
Auto apply on launch:
Minimize to tray:
diff --git a/js/methods.js b/js/methods.js
index 13ff469..a85f718 100644
--- a/js/methods.js
+++ b/js/methods.js
@@ -116,6 +116,7 @@ function preFillSettings() {
notification('danger', "Path to ryzenadj.exe is wrong, please fix it in settings tab.");
}
const settings = require('electron-settings');
+ 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('minimize_to_tray').checked = !!settings.get('settings.minimize_to_tray');
@@ -228,6 +229,14 @@ function registerEventListenerForSettingsInput() {
reapply_periodically: reapply_periodically.value
});
});
+ var start_at_boot = document.getElementById('start_at_boot');
+ start_at_boot.addEventListener('change', function() {
+ settings.set('settings', {
+ ...settings.get('settings'),
+ start_at_boot: !!start_at_boot.checked
+ });
+ require('electron').remote.app.setLoginItemSettings({ openAtLogin: !!start_at_boot.checked });
+});
}
/**
diff --git a/main.js b/main.js
index 822a1d4..0958570 100644
--- a/main.js
+++ b/main.js
@@ -9,6 +9,9 @@ if (setupEvents.handleSquirrelEvent()) {
const {app, BrowserWindow, Menu, Tray} = require('electron')
const settings = require('electron-settings');
+// Check and apply start_on_boot option.
+app.setLoginItemSettings({ openAtLogin: !!settings.get('settings.start_at_boot') });
+
// Check for latest used version and clear settings if needed.
if (settings.get('settings.last_used_version') !== require('./package.json').version) {
settings.delete('settings.ryzen_adj_path');