diff options
Diffstat (limited to '.local/bin/statusbar/sb-gpubar')
-rwxr-xr-x | .local/bin/statusbar/sb-gpubar | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/.local/bin/statusbar/sb-gpubar b/.local/bin/statusbar/sb-gpubar new file mode 100755 index 0000000..d19995d --- /dev/null +++ b/.local/bin/statusbar/sb-gpubar @@ -0,0 +1,26 @@ +#!/bin/sh + +# 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" ;; +esac + +# id total idle +load=$(nvidia-smi --query-gpu=utilization.memory --format=csv | awk 'FNR == 2 {print $1}') +printf "GPU: " +case "$load" in + [0-9]) printf "▁";; + 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 "█";; + *) printf "█";; +esac +printf "\\n" |