Initial commit of utility scripts
This commit is contained in:
parent
ac77586a15
commit
1faeefffd7
34 changed files with 1328 additions and 1 deletions
62
bin/bar_bat.sh
Executable file
62
bin/bar_bat.sh
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
#First we get the capacity
|
||||
charge=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
|
||||
#Now get the status
|
||||
bstat=$(cat /sys/class/power_supply/BAT0/status)
|
||||
|
||||
#Get the symbol for the capacity
|
||||
if [ "$bstat" = "Charging" ]; then
|
||||
cstat=""
|
||||
else
|
||||
cstat=""
|
||||
fi
|
||||
if [ "$charge" -gt 90 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 70 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 50 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 20 ]; then
|
||||
bat="$cstat"
|
||||
else
|
||||
bat=" $cstat"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
battery="$bat $charge%"
|
||||
|
||||
if [ -d /sys/class/power_supply/BAT1 ]; then
|
||||
|
||||
#First we get the capacity
|
||||
charge=$(cat /sys/class/power_supply/BAT1/capacity)
|
||||
|
||||
#Now get the status
|
||||
bstat=$(cat /sys/class/power_supply/BAT1/status)
|
||||
if [ "$bstat" = "Charging" ]; then
|
||||
cstat=""
|
||||
else
|
||||
cstat=""
|
||||
fi
|
||||
#Get the symbol for the capacity
|
||||
if [ "$charge" -gt 90 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 70 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 50 ]; then
|
||||
bat="$cstat"
|
||||
elif [ "$charge" -gt 20 ]; then
|
||||
bat="$cstat"
|
||||
else
|
||||
bat=" $cstat"
|
||||
fi
|
||||
|
||||
echo "$bat $charge% $battery"
|
||||
else
|
||||
echo $battery
|
||||
fi
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue