Configuration file for dwm-bar on macbook air
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.

32 lines
850 B

  1. #!/bin/sh
  2. # A dwm_bar function to read the battery level and status
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. dwm_battery () {
  6. # Change BAT1 to whatever your battery is identified as. Typically BAT0 or BAT1
  7. CHARGE=$(cat /sys/class/power_supply/BAT0/capacity)
  8. STATUS=$(cat /sys/class/power_supply/BAT0/status)
  9. printf "%s" "$SEP1"
  10. if [ "$IDENTIFIER" = "" ]; then
  11. #if [ "$IDENTIFIER" = "unicode" ]; then
  12. if [ "$STATUS" = "Charging" ]; then
  13. printf "🔌 %s%% %s" "$CHARGE" "$STATUS"
  14. else
  15. printf "🔋 %s%% %s" "$CHARGE" "$STATUS"
  16. fi
  17. else
  18. if [ "$STATUS" = "Charging" ]; then
  19. printf "  %s%%" "$CHARGE"
  20. else
  21. printf "  %s%%" "$CHARGE"
  22. #printf "BAT %s%% %s" "$CHARGE" "$STATUS"
  23. fi
  24. fi
  25. printf "%s\n" "$SEP2"
  26. }
  27. dwm_battery