From bfbf8e689a50799093027ff4c86b79e51f512cd9 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 22 May 2026 09:10:33 +0200 Subject: [PATCH] Tweaks --- bin/omarchy-battery-status | 3 +++ shell/plugins/panels/Power.qml | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/omarchy-battery-status b/bin/omarchy-battery-status index ad0e1cbb..78d373e8 100755 --- a/bin/omarchy-battery-status +++ b/bin/omarchy-battery-status @@ -40,9 +40,12 @@ if [[ $shell_output == "true" ]]; then printf 'size\t%s\n' "${capacity}Wh" printf 'time\t%s\n' "$time_remaining" + cycles=$(cat /sys/class/power_supply/BAT*/cycle_count 2>/dev/null | head -1) end=$(cat /sys/class/power_supply/BAT*/charge_control_end_threshold 2>/dev/null | head -1) start=$(cat /sys/class/power_supply/BAT*/charge_control_start_threshold 2>/dev/null | head -1) + [[ -n $cycles ]] && printf 'cycles\t%s\n' "$cycles" + if [[ -n $end ]]; then if [[ -n $start && $start != $end ]]; then printf 'threshold\t%s-%s%%\n' "$start" "$end" diff --git a/shell/plugins/panels/Power.qml b/shell/plugins/panels/Power.qml index 0f22c914..e82a5453 100644 --- a/shell/plugins/panels/Power.qml +++ b/shell/plugins/panels/Power.qml @@ -64,6 +64,7 @@ Panel { var device = UPower.displayDevice return device && device.isPresent && device.state === UPowerDeviceState.FullyCharged } + readonly property bool batteryFull: fullyCharged || (!UPower.onBattery && batteryFraction >= 1) // 0..1 charge level, used by the visual progress bar. readonly property real batteryFraction: { @@ -406,14 +407,14 @@ Panel { width: (parent.width - parent.spacing) / 2 spacing: Style.spacing.labelGap InfoPair { label: "Battery size"; value: root.batteryInfo.size || "" } - InfoPair { label: "Threshold"; value: root.batteryInfo.threshold || "—" } + InfoPair { label: "Charge cycles"; value: root.batteryInfo.cycles || "—" } } Column { width: (parent.width - parent.spacing) / 2 spacing: Style.spacing.labelGap - InfoPair { label: UPower.onBattery ? "Time left" : "Time to full"; value: root.batteryInfo.time || "—" } - InfoPair { label: UPower.onBattery ? "Discharging" : "Charging"; value: root.batteryInfo.rate || "" } + InfoPair { label: UPower.onBattery ? "Time left" : "Time to full"; value: root.batteryFull ? "-" : (root.batteryInfo.time || "—") } + InfoPair { label: UPower.onBattery ? "Discharging" : "Charging"; value: root.batteryFull ? "-" : (root.batteryInfo.rate || "") } } }