plugins/battery: Refactor extraction of percentage without a non-POSIX option

This commit is contained in:
Koichi Murase
2022-01-08 14:14:05 +09:00
parent 4637e4bd2e
commit 738c65dbff

View File

@@ -61,7 +61,7 @@ battery_percentage(){
if command_exists upower;
then
local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | grep percentage | tail --bytes 5)
local UPOWER_OUTPUT=$(_omb_plugin_battery__upower_print_info | sed -n 's/.*percentage[:[:blank:]]*\([0-9%]\{1,\}\)$/\1/p')
echo ${UPOWER_OUTPUT: : -1}
elif command_exists acpi;
then