Rice laptop
This commit is contained in:
12
home/scripts/batlvl.sh
Normal file
12
home/scripts/batlvl.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ac_status=$(cat /sys/class/power_supply/AC/online)
|
||||
bat_status=$(cat /sys/class/power_supply/BAT0/status)
|
||||
bat_lvl=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
if (("$ac_status" == 0)); then
|
||||
echo "$bat_status - $bat_lvl%"
|
||||
else
|
||||
if [ "$bat_lvl" -lt "90" ]; then
|
||||
echo "$bat_status - $bat_lvl%"
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user