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

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

percent="$(echo $acpireport | awk '{print $4}')"
state="$(echo $acpireport | awk '{print $3}')"
time="$(echo $acpireport | awk '{print $5}')"

if [[ "${state::-1}" == "Discharging" ]]; then
  echo "${percent::-1} | ${time::-3} ↓"
else 
  echo "${percent::-1} | ${time::-3} ↑"
fi