Actualiser .i3blocks/batterybar

This commit is contained in:
Breizh 2024-03-11 12:36:54 +01:00
parent cad4ac1b65
commit c0aa471b7b

View file

@ -82,49 +82,18 @@ percents=$(( percentage / 2 ))
## à partir des données brutes ## à partir des données brutes
# percents=$(( (POWER_SUPPLY_CHARGE_NOW - MIN) * 48 / (MAX - MIN) )) # percents=$(( (POWER_SUPPLY_CHARGE_NOW - MIN) * 48 / (MAX - MIN) ))
# Définition des symboles
chars=("█" "░" "░" "▒" "▒" "▓" "▓" "█")
#chars=("█" "▏" "▎" "▍" "▌" "▋" "▊" "▉")
#chars=("█" "▁" "▂" "▃" "▄" "▅" "▆" "▇")
full_squares=$(( percents / 8 )) full_squares=$(( percents / 8 ))
for t in $(seq 1 $full_squares) for t in $(seq 1 $full_squares)
do do
squares+="█" squares+="${chars[0]}"
done done
if [[ $(( percents - ( full_squares * 8 ) )) -eq 7 ]] squares+="${chars[$(( percents - ( full_squares * 8 ) ))]}"
then
#squares+="█"
squares+="▉"
#squares+="▇"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 6 ]]
then
#squares+="▓"
squares+="▊"
#squares+="▆"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 5 ]]
then
#squares+="▓"
squares+="▋"
#squares+="▅"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 4 ]]
then
#squares+="▒"
squares+="▌"
#squares+="▄"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 3 ]]
then
#squares+="▒"
squares+="▍"
#squares+="▃"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 2 ]]
then
#squares+="░"
squares+="▎"
#squares+="▂"
elif [[ $(( percents - ( full_squares * 8 ) )) -eq 1 ]]
then
#squares+="░"
squares+="▏"
#squares+="▁"
fi
# Complétion de la barre afin d'avoir une taille fixe # Complétion de la barre afin d'avoir une taille fixe
blanks=$(( 6 - ${#squares} )) blanks=$(( 6 - ${#squares} ))