#!/bin/sh

PATH_BATTERY="/sys/class/power_supply/BAT0"

status=$(cat "$PATH_BATTERY/status")
charge=$(cat "$PATH_BATTERY/capacity")

if [ "$status" = "Charging" ]; then
  # Идёт зарядка.
  if [ "$charge" -le 20 ]; then
    icon=""
  elif [ "$charge" -le 50 ]; then
    icon=""
  elif [ "$charge" -le 70 ]; then
    icon=""
  elif [ "$charge" -le 80 ]; then
    icon=""
  elif [ "$charge" -le 90 ]; then
    icon=""
  elif [ "$charge" -le 97 ]; then
    icon=""
  else
    icon=" "
  fi
else
  if [ "$charge" -le 10 ]; then
    icon=""
  elif [ "$charge" -le 30 ]; then
    icon=""
  elif [ "$charge" -le 40 ]; then
    icon=""
  elif [ "$charge" -le 50 ]; then
    icon=""
  elif [ "$charge" -le 60 ]; then
    icon=""
  elif [ "$charge" -le 70 ]; then
    icon=""
  elif [ "$charge" -le 80 ]; then
    icon=""
  elif [ "$charge" -le 90 ]; then
    icon=""
  elif [ "$charge" -le 97 ]; then
    icon=""
  else
    icon=""
  fi
fi

echo "$icon $charge%"
