diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-05 19:26:12 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-05 19:26:12 +1000 |
| commit | eb10c6073469ed3b9ebf1ac3f8161d1cd55ea3f1 (patch) | |
| tree | 436585fb79b1096bab353cb8c9a81044ef2e0bcb /modules | |
| parent | bar: fix popout wrapping and morphing (diff) | |
| download | caelestia-shell-eb10c6073469ed3b9ebf1ac3f8161d1cd55ea3f1.tar.gz caelestia-shell-eb10c6073469ed3b9ebf1ac3f8161d1cd55ea3f1.tar.bz2 caelestia-shell-eb10c6073469ed3b9ebf1ac3f8161d1cd55ea3f1.zip | |
popouts: battery add perf degradation warning
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/bar/popouts/Battery.qml | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/modules/bar/popouts/Battery.qml b/modules/bar/popouts/Battery.qml index 90a6181..e36b3e2 100644 --- a/modules/bar/popouts/Battery.qml +++ b/modules/bar/popouts/Battery.qml @@ -35,6 +35,65 @@ Column { text: UPower.displayDevice.isLaptopBattery ? qsTr("Time %1: %2").arg(UPower.onBattery ? "remaining" : "until charged").arg(UPower.onBattery ? formatSeconds(UPower.displayDevice.timeToEmpty, "Calculating...") : formatSeconds(UPower.displayDevice.timeToFull, "Fully charged!")) : qsTr("Power profile: %1").arg(PowerProfile.toString(PowerProfiles.profile)) } + Loader { + anchors.horizontalCenter: parent.horizontalCenter + + active: PowerProfiles.degradationReason !== PerformanceDegradationReason.None + asynchronous: true + + height: active ? (item?.implicitHeight ?? 0) : 0 + + sourceComponent: StyledRect { + implicitWidth: child.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: child.implicitHeight + Appearance.padding.smaller * 2 + + color: Colours.palette.m3error + radius: Appearance.rounding.normal + + Column { + id: child + + anchors.centerIn: parent + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: Appearance.spacing.small + + MaterialIcon { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -font.pointSize / 10 + + text: "warning" + color: Colours.palette.m3onError + } + + StyledText { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Performance Degraded") + color: Colours.palette.m3onError + font.family: Appearance.font.family.mono + font.weight: 500 + } + + MaterialIcon { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -font.pointSize / 10 + + text: "warning" + color: Colours.palette.m3onError + } + } + + StyledText { + anchors.horizontalCenter: parent.horizontalCenter + + text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason)) + color: Colours.palette.m3onError + } + } + } + } + StyledRect { id: profiles |