+ storage
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
displayResources() {
|
||||
operation=$1
|
||||
extra_arg=$2
|
||||
|
||||
if [[ "${operation}" == "memory" ]]; then
|
||||
echo /home/poq/.config/nwg-panel/icons/memory-solid-full.svg
|
||||
@@ -20,9 +21,14 @@ displayResources() {
|
||||
# the process that consumes the most cpu
|
||||
echo /home/poq/.config/nwg-panel/icons/noun-cpu-8293079.svg
|
||||
ps -eo pid,comm,%cpu --sort=-%cpu | head -n 2 | awk 'NR==2 {printf "%s: %s (%s%)", $1, $2, $3}'
|
||||
elif [[ "${operation}" == "drive" ]]; then
|
||||
# display used drive space
|
||||
extra_arg=${extra_arg:=/dev/nvme0n1p2}
|
||||
echo /home/poq/.config/nwg-panel/icons/noun-storage-5078021.svg
|
||||
df -h ${extra_arg} | awk 'NR==2 {printf "%s/%s (%s)\n", $3, $2, $5}'
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
displayResources $1
|
||||
displayResources $1 $2
|
||||
|
||||
Reference in New Issue
Block a user