diff --git a/dots/bin/resources.sh b/dots/bin/resources.sh index 42ac42f..66a879e 100755 --- a/dots/bin/resources.sh +++ b/dots/bin/resources.sh @@ -12,6 +12,12 @@ displayResources() { elif [[ "${operation}" == "cpu" ]]; then echo /home/poq/.config/nwg-panel/icons/microchip-solid-full.svg (grep 'cpu ' /proc/stat; sleep 0.1; grep 'cpu ' /proc/stat) | awk -v RS="" '{printf "%.1f%%", ($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)"%"}' + elif [[ "${operation}" == "topmem" ]]; then + # the process that consumes the most memory + ps -eo pid,cmd,%mem --sort=-%mem | head -n 2 | awk 'NR==2 {printf "%s: %s (%s%)", $1, $2, $4}' + elif [[ "${operation}" == "topcpu" ]]; then + # the process that consumes the most cpu + ps -eo pid,comm,%cpu --sort=-%cpu | head -n 2 | awk 'NR==2 {printf "%s: %s (%s%)", $1, $2, $3}' else echo "" fi