From e99afc98f82a7b606d5ace443accd3ee0b6571b0 Mon Sep 17 00:00:00 2001 From: Michael D Lambert Date: Fri, 20 Feb 2026 12:29:45 -0500 Subject: [PATCH] Simplified battery percentage retrieval command (#2922) * Simplified battery percentage retrieval command Simplified the battery percentage extraction command. * Used int instead of adding 0, put exit back in Changed to use int. Put exit back in to only return first battery in case of systems with multiple batteries. --- bin/omarchy-battery-remaining | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bin/omarchy-battery-remaining b/bin/omarchy-battery-remaining index a6083352..26ea718f 100755 --- a/bin/omarchy-battery-remaining +++ b/bin/omarchy-battery-remaining @@ -3,10 +3,7 @@ # Returns the battery percentage remaining as an integer. # Used by the battery monitor and the Ctrl + Shift + Super + B hotkey. -upower -i $(upower -e | grep BAT) \ -| awk -F: '/percentage/ { - gsub(/[%[:space:]]/, "", $2); - val=$2; - printf("%d\n", (val+0.5)) +upower -i $(upower -e | grep BAT) | awk '/percentage/ { + print int($2) exit - }' +}'