Actualiser .i3blocks/batterybar
This commit is contained in:
parent
98d40925ca
commit
cad4ac1b65
1 changed files with 7 additions and 4 deletions
|
@ -17,9 +17,9 @@ human_time() {
|
|||
source /sys/class/power_supply/BAT1/uevent
|
||||
time="$(date +%s)"
|
||||
|
||||
# Min et max hardcodés (20 et 80 % ici)
|
||||
MIN=1112600
|
||||
MAX=4452000
|
||||
# Min et max personnalisés (20 et 80 % ici)
|
||||
MIN="$(( POWER_SUPPLY_CHARGE_FULL * 2 / 10 ))"
|
||||
MAX="$(( POWER_SUPPLY_CHARGE_FULL * 8 / 10 ))"
|
||||
|
||||
# Utiliser toute la plage de la batterie
|
||||
#MIN=0
|
||||
|
@ -62,6 +62,8 @@ else
|
|||
remaining_secs=0
|
||||
fi
|
||||
|
||||
[[ "$remaining_secs" -lt 0 ]] && remaining_secs=0
|
||||
|
||||
remaining="$(human_time "$remaining_secs")"
|
||||
|
||||
# Définition des couleurs
|
||||
|
@ -143,7 +145,7 @@ case "${status}" in
|
|||
color="$ac_color"
|
||||
;;
|
||||
"Discharging"|"Unknown")
|
||||
if (( percentage >= 0 && percentage < 10 )); then
|
||||
if (( percentage < 10 )); then
|
||||
color="${dis_colors[0]}"
|
||||
elif (( percentage >= 10 && percentage < 20 )); then
|
||||
color="${dis_colors[1]}"
|
||||
|
@ -175,3 +177,4 @@ fi
|
|||
# Affichage
|
||||
echo "bat $message"
|
||||
echo "bat <span foreground=\"$color\">${percentage}%</span>"
|
||||
declare -p MIN MAX percents percentage >&2
|
||||
|
|
Loading…
Reference in a new issue