aboutsummaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2015-10-08 14:10:35 +0200
committertoni <matzeton@googlemail.com>2015-10-08 14:10:35 +0200
commit1e941c775f36817747715152e147452ce78a8d8b (patch)
tree6b458ada044703ea39522b828f87fdb07bdf571a /configs
parentd41bf82bb2d189fdebc7fa4958d2c01fada1afba (diff)
stuff
Diffstat (limited to 'configs')
-rwxr-xr-xconfigs/xmobar_gputemp.sh31
1 files changed, 20 insertions, 11 deletions
diff --git a/configs/xmobar_gputemp.sh b/configs/xmobar_gputemp.sh
index eb5bf64..793b1d1 100755
--- a/configs/xmobar_gputemp.sh
+++ b/configs/xmobar_gputemp.sh
@@ -1,18 +1,27 @@
#!/bin/bash
if [ "x$1" = "xmem" ]; then
- nvidia-smi | grep -oE '[0-9]{1,3}%\s*[0-9]{1,4}MB\s*/\s*[0-9]{1,4}MB'
+ echo -ne "GPU(MEM): "
+ OUT=$(nvidia-smi | sed -n 's/.*\s\([0-9]\{1,3\}\)\%\s.*/\1/p')
else
+ echo -ne "GPU(TMP): "
OUT=$(nvidia-smi | sed -n 's/\(.*\)\([0-9]\{2,3\}\)C\(.*\)/\2/p')
- if [ "x$OUT" = "x" ]; then
- echo "<fc=#FF0000>ERR</fc>"
- elif [ $OUT -gt 75 ]; then
- echo "<fc=#FF0000>$OUT</fc>°C"
- elif [ $OUT -ge 65 ]; then
- echo "<fc=#FFFF00>$OUT</fc>°C"
- elif [ $OUT -ge 50 ]; then
- echo "<fc=#00FF00>$OUT</fc>°C"
+fi
+if [ "x$OUT" = "x" ]; then
+ echo "<fc=#FF0000>ERR</fc>"
+fi
+for tmp in $OUT; do
+ if [ $tmp -gt 75 ]; then
+ echo -ne "<fc=#FF0000>$tmp</fc>°C"
+ elif [ $tmp -ge 65 ]; then
+ echo -ne "<fc=#FFFF00>$tmp</fc>°C"
+ elif [ $tmp -ge 50 ]; then
+ echo -ne "<fc=#00FF00>$tmp</fc>°C"
else
- echo "$OUT°C"
+ if [ "x$1" = "xmem" ]; then
+ echo -ne "$tmp% "
+ else
+ echo -ne "$tmp°C "
+ fi
fi
-fi
+done