From 53505207eb4f921753684abfbb0179b92e725db0 Mon Sep 17 00:00:00 2001 From: Dylan Date: Wed, 30 Mar 2016 14:13:40 +1100 Subject: [PATCH] Only cache OS X GPU output --- neofetch | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 05adb5b1..56526e3c 100755 --- a/neofetch +++ b/neofetch @@ -949,12 +949,6 @@ getcpu () { # GPU {{{ getgpu () { - # Use cache if it exists - if [ -f "/tmp/neofetch/gpu" ]; then - source "/tmp/neofetch/gpu" - return - fi - case "$os" in "Linux") gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")" @@ -1027,7 +1021,13 @@ getgpu () { ;; "Mac OS X") - gpu=$(system_profiler SPDisplaysDataType | awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}') + # Use cache if it exists + if [ -f "/tmp/neofetch/gpu" ]; then + source "/tmp/neofetch/gpu" + else + gpu=$(system_profiler SPDisplaysDataType | awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}') + cache "gpu" "$gpu" + fi gpu=${gpu//'/ $'} gpu=${gpu%,*} ;; @@ -1075,9 +1075,6 @@ getgpu () { gpu=${gpu//+( )/ } gpu="${gpu}${count}" - - # Cache the output - cache "gpu" "$gpu" } # }}}