#!/bin/bash

case $BUTTON in
	3) notify-send "Battery Module" "Shows battery status info 
- Scroll to adjust the backlight.";;
	4) mod_backlight up ;;
	5) mod_backlight down ;;
	6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac

icon=""

IFS=" " read -ra parts <<< "$(bash-status-bat)"

parts_0=${parts[0]}
current=${parts_0//\%/}
state=${parts[1]}
status="$current%"

if [[ "$state" == "discharging" ]]; then
    case $((current/20+1)) in
        1)
            icon=" "
            ;;
        2)
            icon=" "
            ;;
        3)
            icon=" "
            ;;
        4)
            icon=" "
            ;;
        5)
            icon=" "
            ;;
    esac
fi

case $state in
    not-charging)
        icon=" "
        ;;
    fully-charged|full)
        icon=" "
        status="Full"
        ;;
    charging)
        icon=" "
        ;;
esac

echo "$icon $status"
