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.

27 lines
964 B

  1. #!/bin/sh
  2. # A dwm_bar function to display information regarding system memory, CPU temperature, and storage
  3. # Joe Standring <git@joestandring.com>
  4. # GNU GPLv3
  5. dwm_resources () {
  6. # Used and total memory
  7. MEMUSED=$(free -h | awk '(NR == 2) {print $3}')
  8. MEMTOT=$(free -h |awk '(NR == 2) {print $2}')
  9. # CPU temperature
  10. CPU=$(sysctl -n hw.sensors.cpu0.temp0 | cut -d. -f1)
  11. # Used and total storage in /home (rounded to 1024B)
  12. STOUSED=$(df -h | grep '/home$' | awk '{print $3}')
  13. STOTOT=$(df -h | grep '/home$' | awk '{print $2}')
  14. STOPER=$(df -h | grep '/home$' | awk '{print $5}')
  15. printf "%s" "$SEP1"
  16. if [ "$IDENTIFIER" = "unicode" ]; then
  17. printf "💻 MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
  18. else
  19. printf "STA | MEM %s/%s CPU %s STO %s/%s: %s" "$MEMUSED" "$MEMTOT" "$CPU" "$STOUSED" "$STOTOT" "$STOPER"
  20. fi
  21. printf "%s\n" "$SEP2"
  22. }
  23. dwm_resources