Fix upower output bug with 100%
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user