From 09c6b5e5cbb52940dc3d190784909e4fb8af8372 Mon Sep 17 00:00:00 2001 From: Andrew Davidson Date: Thu, 6 Jun 2019 18:10:16 -0400 Subject: [PATCH] fixing memory display to be a bit more friendly, fixes #2 --- tmux/.tmux.conf | 2 +- tmux/bin/tmux-free-memory.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 919b175..eea0aeb 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -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 diff --git a/tmux/bin/tmux-free-memory.sh b/tmux/bin/tmux-free-memory.sh index c9cf24e..8e3406d 100755 --- a/tmux/bin/tmux-free-memory.sh +++ b/tmux/bin/tmux-free-memory.sh @@ -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