config/.local/bin/status-bat
2023-04-24 23:15:34 +09:30

53 lines
868 B
Bash
Executable File

#!/bin/bash
case $BUTTON in
3) notify-send "Scroll to change adjust 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"