mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Add function to cycle power profiles in reverse order
This commit is contained in:
@@ -28,4 +28,5 @@ NIconButton {
|
||||
border.color: Style.capsuleBorderColor
|
||||
border.width: Style.capsuleBorderWidth
|
||||
onClicked: PowerProfileService.cycleProfile()
|
||||
onRightClicked: PowerProfileService.cycleProfileReverse()
|
||||
}
|
||||
|
||||
@@ -392,6 +392,10 @@ Item {
|
||||
PowerProfileService.cycleProfile();
|
||||
}
|
||||
|
||||
function cycleReverse() {
|
||||
PowerProfileService.cycleProfileReverse();
|
||||
}
|
||||
|
||||
function set(mode: string) {
|
||||
switch (mode) {
|
||||
case "performance":
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user