add scripts, mostly taken from LARBS
This commit is contained in:
@@ -9,31 +9,32 @@ case $BLOCK_BUTTON in
|
||||
♻: stagnant charge
|
||||
🔌: charging
|
||||
⚡: charged
|
||||
❗: battery very low!
|
||||
- Scroll to change adjust xbacklight." ;;
|
||||
4) xbacklight -inc 10 ;;
|
||||
5) xbacklight -dec 10 ;;
|
||||
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
||||
esac
|
||||
|
||||
# acpi alternative
|
||||
acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /🔋/;s/[Nn]ot charging, /🛑/;s/[Cc]harging, /🔌/;s/[Uu]nknown, /♻️/;s/[Ff]ull, /⚡/;s/ \(remaining\|until charged\)//"; exit
|
||||
done | sed 's/ *$//'
|
||||
# # acpi alternative
|
||||
# acpi | sed "s/Battery [0-9]: //;s/[Dd]ischarging, /🔋/;s/[Nn]ot charging, /🛑/;s/[Cc]harging, /🔌/;s/[Uu]nknown, /♻️/;s/[Ff]ull, /⚡/;s/ \(remaining\|until charged\)//"; exit
|
||||
# done | sed 's/ *$//'
|
||||
|
||||
# Loop through all attached batteries and format the info
|
||||
# for battery in /sys/class/power_supply/BAT?*; do
|
||||
# # If non-first battery, print a space separator.
|
||||
# [ -n "${capacity+x}" ] && printf " "
|
||||
# # Sets up the status and capacity
|
||||
# case "$(cat "$battery/status")" in
|
||||
# "Full") status="⚡" ;;
|
||||
# "Discharging") status="🔋" ;;
|
||||
# "Charging") status="🔌" ;;
|
||||
# "Not charging") status="🛑" ;;
|
||||
# "Unknown") status="♻️" ;;
|
||||
# esac
|
||||
# capacity=$(cat "$battery/capacity")
|
||||
# # Will make a warn variable if discharging and low
|
||||
# [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
|
||||
# # Prints the info
|
||||
# printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
|
||||
# done && exit 0
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
# If non-first battery, print a space separator.
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
# Sets up the status and capacity
|
||||
case "$(cat "$battery/status")" in
|
||||
"Full") status="⚡" ;;
|
||||
"Discharging") status="🔋" ;;
|
||||
"Charging") status="🔌" ;;
|
||||
"Not charging") status="🛑" ;;
|
||||
"Unknown") status="♻️" ;;
|
||||
esac
|
||||
capacity=$(cat "$battery/capacity")
|
||||
# Will make a warn variable if discharging and low
|
||||
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
|
||||
# Prints the info
|
||||
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
|
||||
done && printf "\\n"
|
||||
|
||||
Reference in New Issue
Block a user