Initial commit of utility scripts

This commit is contained in:
Alex Selimov 2024-12-12 20:16:38 -05:00
parent ac77586a15
commit 1faeefffd7
34 changed files with 1328 additions and 1 deletions

62
bin/bar_bat.sh Executable file
View 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