aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/bar/ischarging
blob: 29d736bf88b1d1c5f09dd4dce201e3334e453f1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

acpireport="$(acpi | grep -v unavailable | head -n 1)"

state="$(echo $acpireport | awk '{print $3}')"
percent="$(echo $acpireport | sed -n 's/.* \([0-9]\+\)%.*/\1/p')"

if [[ "${state::-1}" != "Charging" ]]; then
  if ((${percent} <= 75)); then
    echo "PLUG IN CHARGER"
    exit 1
  fi
fi

exit 0