Commit b36528dd authored by Dylan Araps's avatar Dylan Araps

GPU: Add caching support for all OS

parent 7749be41
......@@ -919,12 +919,14 @@ get_cpu_usage() {
}
get_gpu() {
# Use cache if it exists
if [[ -f "${cache_dir}/neofetch/gpu" ]]; then
source "${cache_dir}/neofetch/gpu"
return
fi
case "$os" in
"Linux" | "GNU")
# Use cache if it exists
if [[ -f "/tmp/neofetch/gpu" ]]; then
source "/tmp/neofetch/gpu"
else
gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/Display|3D|VGA/ {print $3 " " $4}')"
case "$gpu" in
......@@ -951,21 +953,12 @@ get_gpu() {
[[ "$gpu" =~ "intel" ]] && \
gpu="Intel Integrated Graphics"
cache "gpu" "$gpu"
fi
;;
"Mac OS X")
# Use cache if it exists
if [[ -f "${cache_dir}/neofetch/gpu" ]]; then
source "${cache_dir}/neofetch/gpu"
else
gpu="$(system_profiler SPDisplaysDataType | awk -F': ' '/^\ *Chipset Model:/ {printf $2 ", "}')"
gpu="${gpu//'/ $'}"
gpu="${gpu%,*}"
cache "gpu" "$gpu"
fi
;;
"iPhone OS")
......@@ -1030,6 +1023,8 @@ get_gpu() {
gpu="${gpu/NVIDIA}"
gpu="${gpu/Intel}"
fi
cache "gpu" "$gpu"
}
get_memory() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment