powerprofile switcher

This commit is contained in:
Zacharias-Brohn
2026-02-12 14:31:33 +01:00
parent ae23c309a2
commit 7efe7f44bf
10 changed files with 266 additions and 12 deletions
+13 -5
View File
@@ -10,10 +10,18 @@ import qs.Modules
Item {
id: root
implicitWidth: layout.childrenRect.width
implicitWidth: layout.childrenRect.width + 10 * 2
anchors.top: parent.top
anchors.bottom: parent.bottom
CustomRect {
anchors.fill: parent
anchors.topMargin: 3
anchors.bottomMargin: 3
color: DynamicColors.tPalette.m3surfaceContainer
radius: 1000
}
RowLayout {
id: layout
anchors.centerIn: parent
@@ -24,10 +32,10 @@ Item {
text: {
if (!Helpers.UPower.displayDevice.isLaptopBattery) {
if (PowerProfiles.profile === PowerProfile.PowerSaver)
return "energy_savings_leaf";
return "nest_eco_leaf";
if (PowerProfiles.profile === PowerProfile.Performance)
return "rocket_launch";
return "balance";
return "bolt";
return "power_settings_new";
}
const perc = Helpers.UPower.displayDevice.percentage;
@@ -45,7 +53,7 @@ Item {
CustomText {
Layout.alignment: Qt.AlignVCenter
text: Helpers.UPower.displayDevice.isLaptopBattery ? qsTr("%1%").arg(Math.round(UPower.displayDevice.percentage * 100)) : qsTr("NaN")
text: Helpers.UPower.displayDevice.isLaptopBattery ? qsTr("%1%").arg(Math.round(UPower.displayDevice.percentage * 100)) : (PowerProfiles.profile === PowerProfile.PowerSaver ? qsTr("Pwr Sav") : PowerProfiles.profile === PowerProfile.Performance ? qsTr("Perf") : qsTr("Bal"))
}
}
}