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.

26 lines
683 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/BAT1/capacity)
  8. STATUS=$(cat /sys/class/power_supply/BAT1/status)
  9. printf "%s" "$SEP1"
  10. if [ "$IDENTIFIER" = "unicode" ]; then
  11. if [ "$STATUS" = "Charging" ]; then
  12. printf "🔌 %s%% %s" "$CHARGE" "$STATUS"
  13. else
  14. printf "🔋 %s%% %s" "$CHARGE" "$STATUS"
  15. fi
  16. else
  17. printf "BAT %s%% %s" "$CHARGE" "$STATUS"
  18. fi
  19. printf "%s\n" "$SEP2"
  20. }
  21. dwm_battery