Fix upower output bug with 100%
parent
98f13c7b6a
commit
00bb17c3e5
|
|
@ -47,15 +47,8 @@ battery_percentage(){
|
||||||
|
|
||||||
if command_exists upower;
|
if command_exists upower;
|
||||||
then
|
then
|
||||||
local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage)
|
local UPOWER_OUTPUT=$(upower --show-info $(upower --enumerate | grep BAT) | grep percentage | tail --bytes 5)
|
||||||
case UPOWER_OUTPUT in
|
echo ${UPOWER_OUTPUT: : -1}
|
||||||
100*)
|
|
||||||
echo '100'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $UPOWER_OUTPUT | tail --bytes 4 | head --bytes 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif command_exists acpi;
|
elif command_exists acpi;
|
||||||
then
|
then
|
||||||
local ACPI_OUTPUT=$(acpi -b)
|
local ACPI_OUTPUT=$(acpi -b)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue