My i3 configurations and scripts.
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.

processList.sh 737B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. echo "{\"version\":1}"
  3. INFO='#E9F1FF'
  4. NORMAL='#B3FF6C'
  5. WARNING='#FF6836'
  6. CRITICAL='#FF474A'
  7. echo "[[]"
  8. while true; do
  9. (
  10. echo -n ",["
  11. ps ux --sort -%cpu | head -n 30 | sed 's/\s\{2,\}/ /g' | cut -d" " -f3,11 | uniq | grep -v uniq | egrep -v '^0.0' | egrep '^[0-9.]* [a-z]' | while read cpu bin; do
  12. if [ $(echo "if (${cpu} < 3 ) 1 else 0" | bc) -eq 1 ]; then
  13. COLOR=$INFO
  14. elif [ $(echo "if (${cpu} < 40.0 ) 1 else 0" | bc) -eq 1 ]; then
  15. COLOR=$NORMAL
  16. elif [ $(echo "if (${cpu} < 70.0 ) 1 else 0" | bc) -eq 1 ]; then
  17. COLOR=$WARNING
  18. else
  19. COLOR=$CRITICAL
  20. fi
  21. echo -n "{\"full_text\": \" $bin ($cpu%) \", \"color\": \"$COLOR\"},"
  22. done
  23. echo "]"
  24. ) | sed 's/,\]/]/'
  25. sleep 5
  26. done