summaryrefslogtreecommitdiff
path: root/.local/bin/blocks/memory
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/blocks/memory')
-rwxr-xr-x.local/bin/blocks/memory44
1 files changed, 0 insertions, 44 deletions
diff --git a/.local/bin/blocks/memory b/.local/bin/blocks/memory
deleted file mode 100755
index c581a53..0000000
--- a/.local/bin/blocks/memory
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-LABEL=${LABEL:"+"}
-TYPE="${TYPE:-mem}"
-
-awk -v type=$TYPE '
-/^MemTotal:/ {
- mem_total=$2
-}
-/^MemFree:/ {
- mem_free=$2
-}
-/^Buffers:/ {
- mem_free+=$2
-}
-/^Cached:/ {
- mem_free+=$2
-}
-END {
- free=mem_free/1024/1024
- used=(mem_total-mem_free)/1024/1024
- total=mem_total/1024/1024
-
- pct=0
- if (total > 0) {
- pct=used/total*100
- }
-
- # Full text.
- # printf("%s %.1fG/%.1fG (%.f%%)\n", LABEL, used, total, pct)
- printf("%s %.1fG\n", LABEL, used)
- # Short text.
- printf("%s %.f%%\n", LABEL, pct)
-
- # Color.
- if (pct > 90) {
- print("#FF0000")
- } else if (pct > 80) {
- print("#FFAE00")
- } else if (pct > 70) {
- print("#FFF600")
- }
-}
-' /proc/meminfo