No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

osb 879B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env sh
  2. #
  3. # pbrisbin 2014 - on screen battery info.
  4. #
  5. ###
  6. body="$(acpi -b | sed 's/^.*: \(.*\), \(.*\)%\(, \)\?\(.*\)\?$/\1 \2 \4/')"
  7. state="${body%% *}"; rest="${body#* }"
  8. level="${rest%% *}"; extra="${rest#* }"
  9. case "$state" in
  10. Unknown|Discharging)
  11. icon='battery-caution'
  12. message="$state - $level%\n$extra"
  13. [ $level -gt 10 ] && icon='battery-low'
  14. [ $level -gt 40 ] && icon='battery-good'
  15. [ $level -gt 97 ] && icon='battery-full'
  16. ;;
  17. Charging)
  18. icon='battery-caution-charging'
  19. message="Charging - $level%\n$extra"
  20. [ $level -gt 10 ] && icon='battery-low-charging'
  21. [ $level -gt 40 ] && icon='battery-good-charging'
  22. [ $level -gt 97 ] && icon='battery-full-charging'
  23. ;;
  24. Full)
  25. icon='battery-full-charged'
  26. message="Fully charged"
  27. ;;
  28. esac
  29. [ -n "$message" ] && notify-send -i "$icon" 'Battery' "$message"