From 00bb17c3e55da908164da52a9fee23c8d35c59f9 Mon Sep 17 00:00:00 2001 From: shine Date: Sun, 11 Jun 2017 15:27:45 +0530 Subject: [PATCH] Fix upower output bug with 100% --- plugins/available/battery.plugin.bash | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/available/battery.plugin.bash b/plugins/available/battery.plugin.bash index 20fa378e..9b81e67f 100644 --- a/plugins/available/battery.plugin.bash +++ b/plugins/available/battery.plugin.bash @@ -47,15 +47,8 @@ battery_percentage(){ if command_exists upower; then - local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage) - case UPOWER_OUTPUT in - 100*) - echo '100' - ;; - *) - echo $UPOWER_OUTPUT | tail --bytes 4 | head --bytes 2 - ;; - esac + local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage | tail --bytes 5) + echo ${UPOWER_OUTPUT: : -1} elif command_exists acpi; then local ACPI_OUTPUT=$(acpi -b)