Only cache OS X GPU output

This commit is contained in:
Dylan 2016-03-30 14:13:40 +11:00
parent ab09bf9670
commit 53505207eb
1 changed files with 7 additions and 10 deletions

View File

@ -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"
}
# }}}