summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-07 17:06:45 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-01-07 17:06:45 +0100
commitbec891dac2cc69a75e4c5d273b4a1f3893f5b14b (patch)
treebe43fe7d00cd56dc72e0d0da00a6c2bb6e64be60
parenta422b3858f2862b4865e2859ad85c977dc83f4b4 (diff)
Update statusbar scripts
-rwxr-xr-x.local/bin/statusbar/sb-cpubars2
-rwxr-xr-x.local/bin/statusbar/sb-gpubar26
-rwxr-xr-x.local/bin/statusbar/sb-memory2
-rwxr-xr-x.local/bin/statusbar/sb-nettraf2
4 files changed, 29 insertions, 3 deletions
diff --git a/.local/bin/statusbar/sb-cpubars b/.local/bin/statusbar/sb-cpubars
index e60864a..1684ead 100755
--- a/.local/bin/statusbar/sb-cpubars
+++ b/.local/bin/statusbar/sb-cpubars
@@ -19,7 +19,7 @@ esac
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" > "$cache"
old=$(cat "$cache")
-printf ""
+printf "CPU: "
echo "$stats" | while read -r row; do
id=${row%% *}
rest=${row#* }
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"
diff --git a/.local/bin/statusbar/sb-memory b/.local/bin/statusbar/sb-memory
index aeeffa2..d64f241 100755
--- a/.local/bin/statusbar/sb-memory
+++ b/.local/bin/statusbar/sb-memory
@@ -9,4 +9,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.2fGiB\n", ( $3 / 1024))}'
+free --mebi | sed -n '2{p;q}' | awk '{printf ("RAM: %2.2fGiB\n", ( $3 / 1024))}'
diff --git a/.local/bin/statusbar/sb-nettraf b/.local/bin/statusbar/sb-nettraf
index 68bf812..132d8bf 100755
--- a/.local/bin/statusbar/sb-nettraf
+++ b/.local/bin/statusbar/sb-nettraf
@@ -26,4 +26,4 @@ update() {
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
-printf " %4sB  %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
+printf "Net:  %4sB  %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)