Merge pull request #193 from dylanaraps/windows_mem
Merge Linux and Windows memory functions.
This commit is contained in:
commit
347a927fe4
1 changed files with 3 additions and 13 deletions
16
neofetch
16
neofetch
|
@ -1089,8 +1089,8 @@ getgpu () {
|
|||
|
||||
getmemory () {
|
||||
case "$os" in
|
||||
"Linux")
|
||||
mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo ))
|
||||
"Linux" | "Windows")
|
||||
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))
|
||||
|
@ -1130,17 +1130,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 +2460,7 @@ bar() {
|
|||
|
||||
# }}}
|
||||
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue