summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/sb-gpubar
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-15 00:14:09 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-15 00:14:09 +0100
commita5b474f244dda3500b676b88efe7d1e9582f302a (patch)
treedcd7cbf8ebd619333f80ab0936089c8411c5fa3d /.local/bin/statusbar/sb-gpubar
parent4896d47c300ef3efdf3c956e72508d3c1ffcffa4 (diff)
Update gpu status
Diffstat (limited to '.local/bin/statusbar/sb-gpubar')
-rwxr-xr-x.local/bin/statusbar/sb-gpubar38
1 files changed, 21 insertions, 17 deletions
diff --git a/.local/bin/statusbar/sb-gpubar b/.local/bin/statusbar/sb-gpubar
index 2fe6658..f9f72a8 100755
--- a/.local/bin/statusbar/sb-gpubar
+++ b/.local/bin/statusbar/sb-gpubar
@@ -3,24 +3,28 @@
# Module showing GPU load as a changing bar.
case $BLOCK_BUTTON in
- 2) setsid -f "$TERMINAL" -e gpuwatch ;;
- 3) notify-send "󰢮 GPU load module" "The bar represents
-GPU load";;
- 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
+2) setsid -f "$TERMINAL" -e gpuwatch ;;
+3) notify-send "󰢮 GPU load module" "The bar represents
+GPU utilization and memory allocation" ;;
+6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-# id total idle
-load=$(nvidia-smi --query-gpu=utilization.memory --format=csv | awk 'FNR == 2 {print $1}')
+memutil=$(nvidia-smi --query-gpu=utilization.gpu --format=csv | awk 'FNR == 2 {print $1}')
+gpuutil=$(nvidia-smi --query-gpu=utilization.memory --format=csv | awk 'FNR == 2 {print $1}')
+# temp=$(nvidia-smi --query-gpu=temperature.gpu --format=csv | awk 'FNR == 2 {print $1}')
printf ""
-case "$load" in
- [0-9]|1[0-9]) printf "▁";;
- 2[0-9]) printf "▂";;
- 3[0-9]) printf "▃";;
- 4[0-9]) printf "▄";;
- 5[0-9]) printf "▅";;
- 6[0-9]) printf "▆";;
- 7[0-9]) printf "▇";;
- 8[0-9]) printf "█";;
- *) printf "█";;
-esac
+for var in $memutil $gpuutil; do
+ case "$var" in
+ [0-9] | 1[0-9]) printf "▁" ;;
+ 2[0-9]) printf "▂" ;;
+ 3[0-9]) printf "▃" ;;
+ 4[0-9]) printf "▄" ;;
+ 5[0-9]) printf "▅" ;;
+ 6[0-9]) printf "▆" ;;
+ 7[0-9]) printf "▇" ;;
+ 8[0-9]) printf "█" ;;
+ *) printf "█" ;;
+ esac
+done
+# printf " $temp°C"
printf "\\n"