From e2ae78c898740181827653692c6e3191b22d795c Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 28 Mar 2016 09:41:53 +1100 Subject: [PATCH] Merge Windows/Linux memory functions --- neofetch | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/neofetch b/neofetch index 8ef16b08..c820964d 100755 --- a/neofetch +++ b/neofetch @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -x # vim: fdm=marker:noai:ts=4:sw=4 # # Neofetch info about your system @@ -1089,7 +1090,7 @@ getgpu () { getmemory () { case "$os" in - "Linux") + "Linux" | "Windows") mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo )) memused=$((${mem[0]} - ${mem[1]} - ${mem[2]} - ${mem[3]})) memused=$((memused / 1024)) @@ -1130,17 +1131,6 @@ getmemory () { esac ;; - - "Windows") - mem="$(awk 'NR < 3 {printf $2 " "}' /proc/meminfo)" - - memtotal=${mem/ *} - memfree=${mem#* } - memavail=$((memtotal - memfree)) - memused=$((memtotal - memavail)) - memused=$((${memused%% *} / 1024)) - memtotal=$((${memtotal%% *} / 1024)) - ;; esac memory="${memused}MB / ${memtotal}MB" @@ -2471,6 +2461,7 @@ bar() { # }}} + # }}}