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.
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)
|
2019-05-05 15:19:30 +00:00
|
|
|
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
|
|
|
|
|
2019-05-05 15:19:30 +00:00
|
|
|
notify-send -t 5000 -i "$icon" "${bat}"
|