aboutsummaryrefslogtreecommitdiff
path: root/configs/xmobar_gputemp.sh
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2014-10-14 22:20:45 +0200
committertoni <matzeton@googlemail.com>2014-10-14 22:20:45 +0200
commitedc12f4b1ff9df92c6adbd912995d19fe9821792 (patch)
tree0c6894d5349f015709f4d4d99ec3aab104f2e8ae /configs/xmobar_gputemp.sh
parent725c71037ba88bc785ae7b7538a61728efcd1f38 (diff)
improved xmobarrc+scripts
Diffstat (limited to 'configs/xmobar_gputemp.sh')
1 files changed, 16 insertions, 1 deletions
diff --git a/configs/xmobar_gputemp.sh b/configs/xmobar_gputemp.sh
index c4dffe3..eb5bf64 100755
--- a/configs/xmobar_gputemp.sh
+++ b/configs/xmobar_gputemp.sh
@@ -1,3 +1,18 @@
#!/bin/bash
-nvidia-smi | grep -oE '[0-9]{2,3}C'
+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'
+else
+ 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"
+ else
+ echo "$OUT°C"
+ fi
+fi