Skip to content

Commit

Permalink
show charging max
Browse files Browse the repository at this point in the history
  • Loading branch information
anlutro committed Feb 1, 2024
1 parent c1ffdae commit 3272f93
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions configs/i3/block-scripts/battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pct=$(echo "$full_text" | cut -d, -f2 | sed s/%// | tr -d '[:space:]')
if ! echo "$full_text" | grep -qF -e 'rate information unavailable' -e 'zero rate'; then
remaining=$(echo "$full_text" | cut -d, -f3 | cut -d' ' -f2)
fi
max=$(cat /sys/class/power_supply/BAT0/charge_control_end_threshold)

if [ "$status" = 'Unknown' ]; then
status="Full"
Expand All @@ -16,6 +17,9 @@ text="$status $pct%"
if [ -n "${remaining-}" ]; then
text="$text $remaining"
fi
if [ "${max:-100}" -lt 100 ]; then
text="$text (max:$max%)"
fi

# long/short text
echo "$text"
Expand Down

0 comments on commit 3272f93

Please sign in to comment.