tenseleyflow/ndotfiles / aeda6ba

Browse files

RAM used skbar script up

Authored by espadonne
SHA
aeda6bac8027b4b3426d4138b30b7001bcba73cc
Parents
c7b3a21
Tree
e684675

1 changed file

StatusFile+-
A sketchybar/plugins/mem.sh 12 0
sketchybar/plugins/mem.shadded
@@ -0,0 +1,12 @@
1
+#!/bin/zsh
2
+# show used system memory
3
+# as reported by `memory_pressure` cmd
4
+#
5
+# NOTE: this is not portable. 
6
+#       and Apple is weird as all_.
7
+#       at least they're unix though.
8
+
9
+free_pct=$(memory_pressure \
10
+  | awk -F': ' '/System-wide memory free percentage/ { gsub(/%/,"",$2); print $2; exit }')
11
+used_pct=$(( 100 - free_pct ))
12
+sketchybar --set "${NAME}" label="${used_pct}%"