+ resources.sh
This commit is contained in:
20
dots/bin/resources.sh
Executable file
20
dots/bin/resources.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 26.03.06 :: klevstul
|
||||
|
||||
|
||||
displayResources() {
|
||||
operation=$1
|
||||
|
||||
if [[ "${operation}" == "memory" ]]; then
|
||||
echo /home/poq/.config/nwg-panel/icons/memory-solid-full.svg
|
||||
free -h | awk '/^Mem:/ {printf "%d/%d gb (%.1f%%)", $3, $2, $3*100/$2}'
|
||||
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)"%"}'
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
displayResources $1
|
||||
Reference in New Issue
Block a user