setroot 990 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. pad=" | "
  3. sound(){
  4. amixer get Master | grep -Eo '[0-9]{1,3}%'
  5. }
  6. load_avg(){
  7. awk '{print $1" "$2" "$3}' /proc/loadavg
  8. }
  9. bttry(){
  10. battery="$(acpi | awk -vFS=', ' '/Discharging/{stat="-"} /Charging/{stat="+"} {print stat$2}' )"
  11. if [ "$battery" = '-15%' ]; then
  12. sct 2000 > /dev/null
  13. elif [ "$battery" = '-10%' ]; then
  14. sct 1500 > /dev/null
  15. elif [ "$battery" = '-7%' ]; then
  16. sct 1000 > /dev/null
  17. elif [ "$battery" = '-5%' ]; then
  18. doas pm-hibernate
  19. fi
  20. echo $battery
  21. }
  22. memory(){
  23. free | awk '/Mem/{printf("%.1f%%\n", $3/$2 * 100.0)}'
  24. }
  25. curdate(){
  26. date "+%A %d.%m.%y %H:%M"
  27. }
  28. music(){
  29. awk '{print substr($0,1,50)}' /tmp/.nowplaying
  30. }
  31. mails(){
  32. for i; do
  33. mailcount="$(ls -1 $HOME/.mutt/mailbox/$i/inbox/new | wc -l)"
  34. [ "$mailcount" != "0" ] && emails=$emails"$i:$mailcount | "
  35. done
  36. echo "$emails"
  37. }
  38. echo "$(music)${pad}$(mails uni personal cock norwid zx riseup)$(load_avg)${pad}R:$(memory)${pad}V:$(sound)${pad}B:$(bttry)${pad}$(curdate)"