dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/bin/pila

21 lines
753 B
Plaintext
Raw Normal View History

2018-01-25 23:37:48 +00:00
#!/bin/bash
if [ -d /sys/class/power_supply/BAT0 ]; then
2019-04-14 15:53:12 +00:00
bat_lvl=$(head -n 1 /sys/class/power_supply/BAT0/capacity)
current_charge=$(echo "$bat_lvl" | grep -o '[0-9]\+%' | awk '{sub (/%/, "", $1); print $1}')
if [[ $current_charge -lt 11 ]]; then
icon="/home/deadguy/Pictures/.icn/battery-empty.png"
elif [[ $current_charge -lt 31 ]]; then
icon="/home/deadguy/Pictures/.icn/battery-caution.png"
elif [[ $current_charge -lt 51 ]]; then
icon="/home/deadguy/Pictures/.icn/battery-low.png"
elif [[ $current_charge -lt 71 ]]; then
icon="/home/deadguy/Pictures/.icn/battery-good.png"
elif [[ $current_charge -lt 98 ]]; then
icon="/home/deadguy/Pictures/.icn/battery-full.png"
fi
bat="$bat_lvl%"
2018-01-25 23:37:48 +00:00
fi
notify-send -t 5000 -i "$icon" "${bat}"