From 8b88d97a7eda79d6cb57ef269c01fde468bd9379 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Fri, 28 Aug 2015 13:55:07 +0000 Subject: [PATCH] added used RAM indicator --- lemonbar.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lemonbar.sh b/lemonbar.sh index 718bbd4..586ee33 100755 --- a/lemonbar.sh +++ b/lemonbar.sh @@ -56,10 +56,20 @@ separator(){ echo -n "%{F$GREY}◆" } +getMEM(){ + total=$(grep 'MemTotal' /proc/meminfo | egrep -o '[0-9]+') + not_apps=0 + for mem in $(egrep '(MemFree|Buffers|Cached|Slab|PageTables|SwapCached)' /proc/meminfo | egrep -o '[0-9]+'); do + not_apps=$((not_apps+mem)) + done + USEDMEM=$(echo "$((total-not_apps))/1000" | bc) + echo -n "%{F$BLUE}$USEDMEM MB" +} + buildBar () { while true do - echo " $(getVolume) $(getMPD) %{c}$(buildClock) %{r} $(getDISK) $(separator) $(getNET) " + echo " $(getVolume) $(getMPD) %{c}$(buildClock) %{r} $(getMEM) $(separator) $(getDISK) $(separator) $(getNET) " sleep 1 done }