feat: power-profile switcher in topbar

This commit is contained in:
Ninjdai
2025-07-15 22:44:24 +02:00
parent bb221326eb
commit 90013c7451
3 changed files with 39 additions and 2 deletions
@@ -104,5 +104,38 @@ Item {
}
}
}
Loader {
active: Config.options.bar.utilButtons.showPerfProfileToggle
visible: Config.options.bar.utilButtons.showPerfProfileToggle
sourceComponent: CircleUtilButton {
Layout.alignment: Qt.AlignVCenter
onClicked: event => {
if (PowerProfiles.hasPerformanceProfile) {
switch(PowerProfiles.profile) {
case PowerProfile.PowerSaver: PowerProfiles.profile = PowerProfile.Balanced
break;
case PowerProfile.Balanced: PowerProfiles.profile = PowerProfile.Performance
break;
case PowerProfile.Performance: PowerProfiles.profile = PowerProfile.PowerSaver
break;
}
} else {
PowerProfiles.profile = PowerProfiles.profile == PowerProfile.Balanced ? PowerProfile.PowerSaver : PowerProfile.Balanced
}
}
MaterialSymbol {
horizontalAlignment: Qt.AlignHCenter
fill: 0
text: switch(PowerProfiles.profile) {
case PowerProfile.PowerSaver: return "battery_saver"
case PowerProfile.Balanced: return "balance"
case PowerProfile.Performance: return "speed"
}
iconSize: Appearance.font.pixelSize.large
color: Appearance.colors.colOnLayer2
}
}
}
}
}
@@ -123,6 +123,7 @@ Singleton {
property bool showMicToggle: false
property bool showKeyboardToggle: true
property bool showDarkModeToggle: true
property bool showPerfProfileToggle: false
}
property JsonObject tray: JsonObject {
property bool monochromeIcons: true
@@ -164,8 +164,11 @@ ContentPage {
}
}
ConfigSwitch {
opacity: 0
enabled: false
text: "Performance Profile toggle"
checked: Config.options.bar.utilButtons.showPerfProfileToggle
onCheckedChanged: {
Config.options.bar.utilButtons.showPerfProfileToggle = checked;
}
}
}
}