aboutsummaryrefslogtreecommitdiff
path: root/i3blocks/i3battery.sh
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-12-17 19:30:56 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2019-12-17 19:30:56 +0100
commit93b14ece7fbe75c09221621e49e16cc245f5b1de (patch)
tree8f7d66bf91ae8e5e1785edb4f0062cb6c8733b99 /i3blocks/i3battery.sh
parent97c24cfef14427189842464a70166a81659b39bf (diff)
downloadscripts-93b14ece7fbe75c09221621e49e16cc245f5b1de.tar.gz
scripts-93b14ece7fbe75c09221621e49e16cc245f5b1de.zip
i3battery.sh now reads battery name from env var.
Diffstat (limited to 'i3blocks/i3battery.sh')
-rwxr-xr-xi3blocks/i3battery.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/i3blocks/i3battery.sh b/i3blocks/i3battery.sh
index 51dfa37..1be8142 100755
--- a/i3blocks/i3battery.sh
+++ b/i3blocks/i3battery.sh
@@ -11,8 +11,9 @@ case $BLOCK_BUTTON in
- Text color reflects charge left" ;;
esac
-status=$(cat /sys/class/power_supply/"$1"/status)
-capacity=$(cat /sys/class/power_supply/"$1"/capacity) || exit 0
+battery="$CONFIG_BATTERY"
+status=$(cat /sys/class/power_supply/"$battery"/status)
+capacity=$(cat /sys/class/power_supply/"$battery"/capacity) || exit 0
[ -f "/bin/acpi" ] && remaining="$(acpi | cut -d' ' -f5 | cut -d':' -f-2)" || remaining="missing acpi"
if [ "$capacity" -ge 80 ]; then