forked from jdpedersen1/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batt.sh
executable file
·34 lines (30 loc) · 1.16 KB
/
batt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# Created By: Jake@Linux
# Created On: Thu 02 Mar 2023 08:50:25 AM UTC
# # Project:
batstat="$(cat /sys/class/power_supply/BAT0/status)"
battery="$(cat /sys/class/power_supply/BAT0/capacity)"
if [[ $batstat != 'Discharging' ]] && [[ $battery -ge 99 ]]; then
batstat=" "
elif [[ $batstat != 'Discharging' ]] && [[ $battery -ge 75 ]]; then
batstat=" "
elif [[ $batstat != 'Discharging' ]] && [[ $battery -ge 50 ]]; then
batstat=" "
elif [[ $batstat != 'Discharging' ]] && [[ $battery -ge 25 ]]; then
batstat=" "
elif [[ $batstat != 'Discharging' ]] && [[ $battery -ge 1 ]]; then
batstat=" "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 5 ]]; then
batstat=" "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 25 ]]; then
batstat="ﮤ "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 50 ]]; then
batstat="ﮤ "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 75 ]]; then
batstat="ﮤ "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 97 ]]; then
batstat="ﮤ "
elif [[ $batstat = 'Discharging' ]] && [[ $battery -le 100 ]]; then
batstat=" "
fi
echo "$batstat $battery%"