Add function to cycle power profiles in reverse order

This commit is contained in:
bean-factory
2026-01-03 17:28:50 +00:00
parent f8350760a1
commit 220949a293
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -28,4 +28,5 @@ NIconButton {
border.color: Style.capsuleBorderColor
border.width: Style.capsuleBorderWidth
onClicked: PowerProfileService.cycleProfile()
onRightClicked: PowerProfileService.cycleProfileReverse()
}
+4
View File
@@ -392,6 +392,10 @@ Item {
PowerProfileService.cycleProfile();
}
function cycleReverse() {
PowerProfileService.cycleProfileReverse();
}
function set(mode: string) {
switch (mode) {
case "performance":
+12
View File
@@ -78,6 +78,18 @@ Singleton {
setProfile(PowerProfile.Balanced);
}
function cycleProfileReverse() {
if (!available)
return;
const current = powerProfiles.profile;
if (current === PowerProfile.Performance)
setProfile(PowerProfile.Balanced);
else if (current === PowerProfile.Balanced)
setProfile(PowerProfile.PowerSaver);
else if (current === PowerProfile.PowerSaver)
setProfile(PowerProfile.Performance);
}
function isDefault() {
if (!available)
return true;