From e2ae78c898740181827653692c6e3191b22d795c Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 28 Mar 2016 09:41:53 +1100 Subject: [PATCH 1/2] 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() { # }}} + # }}} From f358f25e8a7ff2465e3ac42d57652036681df1c9 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 28 Mar 2016 09:47:38 +1100 Subject: [PATCH 2/2] Add 2 dummy numbers to mem function --- neofetch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neofetch b/neofetch index c820964d..537c12de 100755 --- a/neofetch +++ b/neofetch @@ -1,5 +1,4 @@ #!/usr/bin/env bash -set -x # vim: fdm=marker:noai:ts=4:sw=4 # # Neofetch info about your system @@ -1091,7 +1090,7 @@ getgpu () { getmemory () { case "$os" in "Linux" | "Windows") - mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo )) + mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo ) 0 0) memused=$((${mem[0]} - ${mem[1]} - ${mem[2]} - ${mem[3]})) memused=$((memused / 1024)) memtotal=$((${mem[0]} / 1024))