From 5f7ec57585a80f74ff1472a29c292ab90e568d34 Mon Sep 17 00:00:00 2001 From: Ken Gilmer Date: Tue, 28 Jan 2020 21:26:50 -0800 Subject: [PATCH] * Add @cheginit's fix for detecting battery. --- debian/changelog | 6 ++++++ scripts/battery3 | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0463bac..8e728f4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +regolith-i3xrocks-config (2.2.6-1ubuntu1~ppa1) eoan; urgency=medium + + * Add @cheginit's fix for detecting battery. + + -- Regolith Linux Tue, 28 Jan 2020 21:25:36 -0800 + regolith-i3xrocks-config (2.2.5-1ubuntu1~ppa1) eoan; urgency=medium * Add discharge/recharge status to battery3. diff --git a/scripts/battery3 b/scripts/battery3 index 3a4a248..6a25100 100755 --- a/scripts/battery3 +++ b/scripts/battery3 @@ -21,7 +21,8 @@ get_battery_percent() { echo "$__UPOWER_INFO" | awk -W posix '$1 == "percentage:" { gsub("%","",$2); print $2}' } -__UPOWER_INFO=$(upower --show-info "/org/freedesktop/UPower/devices/battery_${BLOCK_INSTANCE:-BAT0}") +BATT_DEVICE=$(upower -e | grep -o 'BAT[0-9]' | HEAD -n 1) +__UPOWER_INFO=$(upower --show-info "/org/freedesktop/UPower/devices/battery_${BLOCK_INSTANCE:-$BATT_DEVICE}") BATT_PERCENT=$(get_battery_percent) CHARGE_STATE=$(get_battery_status)