RAM used skbar script up
- SHA
aeda6bac8027b4b3426d4138b30b7001bcba73cc- Parents
-
c7b3a21 - Tree
e684675
aeda6ba
aeda6bac8027b4b3426d4138b30b7001bcba73ccc7b3a21
e684675| Status | File | + | - |
|---|---|---|---|
| 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}%" | |