fixing memory display to be a bit more friendly, fixes #2

This commit is contained in:
Andrew Davidson 2019-06-06 18:10:16 -04:00
parent 852161c5ce
commit 09c6b5e5cb
Signed by: amd
GPG key ID: 17AF8F2A49CF25C6
2 changed files with 2 additions and 2 deletions

View file

@ -15,7 +15,7 @@ set-window-option -g window-status-current-bg colour236
set-window-option -g window-status-current-fg colour141
# Add some info to the status bar
set -g status-right "#H | up #(uptime | awk '{print $3 \" \" $4}' | sed 's/,//') | #(~/bin/tmux-free-memory.sh) free"
set -g status-right "#H | up #(uptime | awk '{print $3 \" \" $4}' | sed 's/,//') | Mem: #(~/bin/tmux-free-memory.sh) free"
# Auto-set window title
setw -g automatic-rename

View file

@ -2,7 +2,7 @@
if [[ "$OSTYPE" == "linux-gnu" ]]; then
free -m | head -n 2 | tail -n 1 | awk '{print $7}'
free -h --si | head -n 2 | tail -n 1 | awk '{print $7}'
elif [[ "$OSTYPE" == "darwin"* ]]; then
vm_stat | awk 'BEGIN{FS="[:]+"}{if(NR<7&&NR>1)sum+=$2; if(NR==2||NR==4||NR==5)free+=$2} END{printf "%3d%%\n",100*((sum - free)/sum)}'
else