plugin/battery: fix handling of multiple batteries with upower

This commit is contained in:
John D Pell
2022-03-03 23:37:37 -08:00
parent fdff1d81cd
commit 029e53a433
2 changed files with 7 additions and 8 deletions

View File

@@ -199,8 +199,7 @@ function setup_upower {
function upower {
case $1 in
'-e'|'--enumerate')
# don't just `echo` twice because `grep` will close the pipe after matching the first line...
echo "$BAT0"$'\n'"/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery"
printf '%s\n' "$BAT0" "/org/freedesktop/UPower/devices/mouse_hid_${RANDOM}_battery"
;;
'-i'|'--show-info')
if [[ $2 == "$BAT0" ]]