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.

24 lines
645 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. if [ "$IDENTIFIER" = "unicode" ]; then
  10. if [ "$STATUS" = "Charging" ]; then
  11. printf "[🔌 %s%% %s]\n" "$CHARGE" "$STATUS"
  12. else
  13. printf "[🔋 %s %%%s]\n" "$CHARGE" "$STATUS"
  14. fi
  15. else
  16. printf "[BAT %s%% %s]\n" "$CHARGE" "$STATUS"
  17. fi
  18. }
  19. dwm_battery