mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-22 18:13:28 +07:00
Fix #1 Added periodically reapply ryzenadj capability.
This commit is contained in:
parent
4c1451ae71
commit
a8897fba00
10
index.html
10
index.html
@ -74,6 +74,16 @@
|
|||||||
<label><input class="uk-checkbox" type="checkbox" id="apply_last_settings_on_launch"> When checked, Ryzen Controller will try to apply latest used settings on launch.</label>
|
<label><input class="uk-checkbox" type="checkbox" id="apply_last_settings_on_launch"> When checked, Ryzen Controller will try to apply latest used settings on launch.</label>
|
||||||
<h3>Minimize to tray:</h3>
|
<h3>Minimize to tray:</h3>
|
||||||
<label><input class="uk-checkbox" type="checkbox" id="minimize_to_tray"> When checked, Ryzen Controller will minimize to tray instead of taskbar.</label>
|
<label><input class="uk-checkbox" type="checkbox" id="minimize_to_tray"> When checked, Ryzen Controller will minimize to tray instead of taskbar.</label>
|
||||||
|
<h3>Re-apply ryzenadj periodically:</h3>
|
||||||
|
<p>Ryzen Controller will re-apply ryzenadj every X seconds. Set to 0 to disable.</p>
|
||||||
|
<div class="uk-grid-small" uk-grid>
|
||||||
|
<div class="uk-width-1-6">
|
||||||
|
<input class="uk-input" type="number" min="0" step="10" max="3600" value="0" id="reapply_periodically" repeat="reapply_periodically_range">
|
||||||
|
</div>
|
||||||
|
<div class="uk-width-expand">
|
||||||
|
<input class="uk-range" type="range" min="0" step="10" max="3600" value="0" repeat="reapply_periodically" id="reapply_periodically_range">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h3>Ryzenadj path:</h3>
|
<h3>Ryzenadj path:</h3>
|
||||||
<div class="uk-grid-small" uk-grid>
|
<div class="uk-grid-small" uk-grid>
|
||||||
<div class="uk-width-2-3@s">
|
<div class="uk-width-2-3@s">
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
ready(function(){
|
ready(function(){
|
||||||
|
document.isStarting = true;
|
||||||
registerRepeaterForAllInput();
|
registerRepeaterForAllInput();
|
||||||
registerEventListenerForSettingsInput();
|
registerEventListenerForSettingsInput();
|
||||||
checkForAdminRights();
|
checkForAdminRights();
|
||||||
preFillSettings();
|
preFillSettings();
|
||||||
loadLatestUsedSettings();
|
loadLatestUsedSettings();
|
||||||
displayVersion();
|
displayVersion();
|
||||||
|
reApplyPeriodically(require('electron-settings').get('settings.reapply_periodically'));
|
||||||
|
document.isStarting = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +118,8 @@ function preFillSettings() {
|
|||||||
const settings = require('electron-settings');
|
const settings = require('electron-settings');
|
||||||
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('reapply_periodically').value = settings.get('settings.reapply_periodically');
|
||||||
|
document.getElementById('reapply_periodically_range').value = settings.get('settings.reapply_periodically');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,6 +217,14 @@ function registerEventListenerForSettingsInput() {
|
|||||||
minimize_to_tray: !!minimize_to_tray.checked
|
minimize_to_tray: !!minimize_to_tray.checked
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
var reapply_periodically = document.getElementById('reapply_periodically');
|
||||||
|
reapply_periodically.addEventListener('change', function() {
|
||||||
|
reApplyPeriodically(reapply_periodically.value);
|
||||||
|
settings.set('settings', {
|
||||||
|
...settings.get('settings'),
|
||||||
|
reapply_periodically: reapply_periodically.value
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -224,3 +234,23 @@ function displayVersion() {
|
|||||||
const pjson = require('./package.json');
|
const pjson = require('./package.json');
|
||||||
document.getElementById('version').innerHTML = `v${pjson.version}`;
|
document.getElementById('version').innerHTML = `v${pjson.version}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-apply flow for "reapply_periodically" settings.
|
||||||
|
* @param {number} seconds Interval in seconds between each apply.
|
||||||
|
*/
|
||||||
|
function reApplyPeriodically(seconds) {
|
||||||
|
appendLog(`reApplyPeriodically(): seconds = ${seconds}`);
|
||||||
|
appendLog(`reApplyPeriodically(): document.reapplyLoop = ${document.reapplyLoop}`);
|
||||||
|
clearInterval(document.reapplyLoop);
|
||||||
|
document.reapplyLoop = false;
|
||||||
|
|
||||||
|
if (seconds <= 0) {
|
||||||
|
if (!document.isStarting) {
|
||||||
|
notification('primary', "Ryzen Controller no more will re-apply ryzenadj periodically.");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.reapplyLoop = setInterval(applyRyzenSettings, seconds * 1000);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user