summaryrefslogtreecommitdiff
path: root/modules/bar/components/StatusIcons.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-05 18:14:53 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-05 18:14:53 +1000
commitd37b3926c8b4f4ff3b32f2bdb0c1ea5d0dc6ff23 (patch)
tree066612a5a56d33a943cad10159886b7dfa233b2a /modules/bar/components/StatusIcons.qml
parentinternal: fix memory issue (diff)
downloadcaelestia-shell-d37b3926c8b4f4ff3b32f2bdb0c1ea5d0dc6ff23.tar.gz
caelestia-shell-d37b3926c8b4f4ff3b32f2bdb0c1ea5d0dc6ff23.tar.bz2
caelestia-shell-d37b3926c8b4f4ff3b32f2bdb0c1ea5d0dc6ff23.zip
bar: show power profile if no battery
Diffstat (limited to 'modules/bar/components/StatusIcons.qml')
-rw-r--r--modules/bar/components/StatusIcons.qml38
1 files changed, 21 insertions, 17 deletions
diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml
index c1589a2..d2dbe2f 100644
--- a/modules/bar/components/StatusIcons.qml
+++ b/modules/bar/components/StatusIcons.qml
@@ -14,7 +14,7 @@ Item {
clip: true
implicitWidth: Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth, battery.implicitWidth)
- implicitHeight: network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) + (battery.active ? battery.implicitHeight + battery.anchors.topMargin : 0)
+ implicitHeight: network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) + battery.implicitHeight + battery.anchors.topMargin
MaterialIcon {
id: network
@@ -62,30 +62,34 @@ Item {
}
}
- Loader {
+ MaterialIcon {
id: battery
anchors.horizontalCenter: devices.horizontalCenter
anchors.top: repeater.count > 0 ? devices.bottom : bluetooth.bottom
anchors.topMargin: Appearance.spacing.small
- active: UPower.displayDevice.isLaptopBattery
- asynchronous: true
-
- sourceComponent: MaterialIcon {
- text: {
- const perc = UPower.displayDevice.percentage;
- const charging = !UPower.onBattery;
- if (perc === 1)
- return charging ? "battery_charging_full" : "battery_full";
- let level = Math.floor(perc * 7);
- if (charging && (level === 4 || level === 1))
- level--;
- return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
+ animate: true
+ text: {
+ if (!UPower.displayDevice.isLaptopBattery) {
+ if (PowerProfiles.profile === PowerProfile.PowerSaver)
+ return "energy_savings_leaf";
+ if (PowerProfiles.profile === PowerProfile.Performance)
+ return "rocket_launch";
+ return "balance";
}
- color: !UPower.onBattery || UPower.displayDevice.percentage > 0.2 ? root.colour : Colours.palette.m3error
- fill: 1
+
+ const perc = UPower.displayDevice.percentage;
+ const charging = !UPower.onBattery;
+ if (perc === 1)
+ return charging ? "battery_charging_full" : "battery_full";
+ let level = Math.floor(perc * 7);
+ if (charging && (level === 4 || level === 1))
+ level--;
+ return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
}
+ color: !UPower.onBattery || UPower.displayDevice.percentage > 0.2 ? root.colour : Colours.palette.m3error
+ fill: 1
}
Behavior on implicitWidth {