Bash · 383 bytes Raw Blame History
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}%"