+ 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
|
||||
1
dots/nwg-panel/icons/memory-solid-full.svg
Normal file
1
dots/nwg-panel/icons/memory-solid-full.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path fill="white" d="M128 128C92.7 128 64 156.7 64 192L64 199.4C64 206.2 68.4 212 74.1 215.7C87.3 224.3 96 239.1 96 256C96 272.9 87.3 287.7 74.1 296.3C68.4 300 64 305.8 64 312.6L64 368L576 368L576 312.6C576 305.8 571.6 300 565.9 296.3C552.7 287.7 544 272.9 544 256C544 239.1 552.7 224.3 565.9 215.7C571.6 212 576 206.2 576 199.4L576 192C576 156.7 547.3 128 512 128L128 128zM576 480L576 416L64 416L64 480C64 497.7 78.3 512 96 512L160 512L160 488C160 474.7 170.7 464 184 464C197.3 464 208 474.7 208 488L208 512L296 512L296 488C296 474.7 306.7 464 320 464C333.3 464 344 474.7 344 488L344 512L432 512L432 488C432 474.7 442.7 464 456 464C469.3 464 480 474.7 480 488L480 512L544 512C561.7 512 576 497.7 576 480zM224 224L224 288C224 305.7 209.7 320 192 320C174.3 320 160 305.7 160 288L160 224C160 206.3 174.3 192 192 192C209.7 192 224 206.3 224 224zM352 224L352 288C352 305.7 337.7 320 320 320C302.3 320 288 305.7 288 288L288 224C288 206.3 302.3 192 320 192C337.7 192 352 206.3 352 224zM480 224L480 288C480 305.7 465.7 320 448 320C430.3 320 416 305.7 416 288L416 224C416 206.3 430.3 192 448 192C465.7 192 480 206.3 480 224z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
dots/nwg-panel/icons/microchip-solid-full.svg
Normal file
1
dots/nwg-panel/icons/microchip-solid-full.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path fill="white" d="M240 88C240 74.7 229.3 64 216 64C202.7 64 192 74.7 192 88L192 128C156.7 128 128 156.7 128 192L88 192C74.7 192 64 202.7 64 216C64 229.3 74.7 240 88 240L128 240L128 296L88 296C74.7 296 64 306.7 64 320C64 333.3 74.7 344 88 344L128 344L128 400L88 400C74.7 400 64 410.7 64 424C64 437.3 74.7 448 88 448L128 448C128 483.3 156.7 512 192 512L192 552C192 565.3 202.7 576 216 576C229.3 576 240 565.3 240 552L240 512L296 512L296 552C296 565.3 306.7 576 320 576C333.3 576 344 565.3 344 552L344 512L400 512L400 552C400 565.3 410.7 576 424 576C437.3 576 448 565.3 448 552L448 512C483.3 512 512 483.3 512 448L552 448C565.3 448 576 437.3 576 424C576 410.7 565.3 400 552 400L512 400L512 344L552 344C565.3 344 576 333.3 576 320C576 306.7 565.3 296 552 296L512 296L512 240L552 240C565.3 240 576 229.3 576 216C576 202.7 565.3 192 552 192L512 192C512 156.7 483.3 128 448 128L448 88C448 74.7 437.3 64 424 64C410.7 64 400 74.7 400 88L400 128L344 128L344 88C344 74.7 333.3 64 320 64C306.7 64 296 74.7 296 88L296 128L240 128L240 88zM224 192L416 192C433.7 192 448 206.3 448 224L448 416C448 433.7 433.7 448 416 448L224 448C206.3 448 192 433.7 192 416L192 224C192 206.3 206.3 192 224 192zM240 240L240 400L400 400L400 240L240 240z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user