multibattery functionality returned close #899
This commit is contained in:
parent
f70f44e419
commit
219ea40fe9
2 changed files with 7 additions and 11 deletions
|
@ -16,15 +16,12 @@ case $BLOCK_BUTTON in
|
||||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check if battery directories are detected
|
|
||||||
[ ! -e /sys/class/power_supply/BAT?* ] && echo "No battery found" && exit 1
|
|
||||||
|
|
||||||
# Loop through all attached batteries and format the info
|
# Loop through all attached batteries and format the info
|
||||||
for battery in /sys/class/power_supply/BAT?*
|
for battery in /sys/class/power_supply/BAT?*; do
|
||||||
do
|
# If non-first battery, print a space separator.
|
||||||
|
[ -n "${capacity+x}" ] && printf " "
|
||||||
# Sets up the status and capacity
|
# Sets up the status and capacity
|
||||||
status=$(cat "$battery/status")
|
case "$(cat "$battery/status")" in
|
||||||
case "$status" in
|
|
||||||
"Full") status="⚡" ;;
|
"Full") status="⚡" ;;
|
||||||
"Discharging") status="🔋" ;;
|
"Discharging") status="🔋" ;;
|
||||||
"Charging") status="🔌" ;;
|
"Charging") status="🔌" ;;
|
||||||
|
@ -35,5 +32,5 @@ do
|
||||||
# Will make a warn variable if discharging and low
|
# Will make a warn variable if discharging and low
|
||||||
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
|
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
|
||||||
# Prints the info
|
# Prints the info
|
||||||
printf "%s%s%d%%\n" "$status" "$warn" "$capacity"; unset warn
|
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
|
||||||
done && return 0
|
done && exit 0
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
|
custom: ["https://lukesmith.xyz/donate.html", "https://lukesmith.xyz/crypto.html"]
|
||||||
github: lukesmithxyz
|
github: lukesmithxyz
|
||||||
custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"]
|
|
||||||
patreon: lukesmith
|
|
||||||
|
|
Loading…
Reference in a new issue