From e0fed4a9f703650fe795849767318e9052239cb5 Mon Sep 17 00:00:00 2001 From: Federico Sapuppo Date: Wed, 1 Apr 2026 13:00:58 -0300 Subject: [PATCH] Fix battery time showing hours instead of minutes (#5137) When upower reported time in minutes, the value was incorrectly passed through the hours conversion path, displaying e.g. "25h" instead of "25m". --- bin/omarchy-battery-remaining-time | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bin/omarchy-battery-remaining-time b/bin/omarchy-battery-remaining-time index 906d2ab8..c4f39593 100755 --- a/bin/omarchy-battery-remaining-time +++ b/bin/omarchy-battery-remaining-time @@ -7,19 +7,16 @@ battery_info=$(upower -i $(upower -e | grep BAT)) echo "$battery_info" | awk '/time to (empty|full)/ { value = $4 unit = $5 - if (unit == "minutes") { - hours = int(value / 60) - minutes = int(value % 60) + if (unit ~ /^minute/) { + printf "%dm", int(value) } else { hours = int(value) minutes = int((value - hours) * 60) - } - if (hours > 0 && minutes > 0) { - printf "%dh %dm", hours, minutes - } else if (hours > 0) { - printf "%dh", hours - } else { - printf "%dm", minutes + if (minutes > 0) { + printf "%dh %dm", hours, minutes + } else { + printf "%dh", hours + } } exit }'