Fix upower output bug with 100%

pull/976/head
shine 2017-06-11 15:27:45 +05:30
parent 98f13c7b6a
commit 00bb17c3e5
1 changed files with 2 additions and 9 deletions

View File

@ -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)