diff --git a/config/config b/config/config index ac592c92..c9da7910 100644 --- a/config/config +++ b/config/config @@ -291,7 +291,7 @@ disk_display="off" image_source="wallpaper" # Thumbnail directory -thumbnail_dir="$HOME/.cache/thumbnails/neofetch" +thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" # W3m-img path # Only works with the w3m backend. diff --git a/neofetch b/neofetch index 988bfd42..313bccc4 100755 --- a/neofetch +++ b/neofetch @@ -2161,11 +2161,11 @@ make_thumbnail() { *) image_name="${image_name}-${image##*/}.jpg" ;; esac + # Create the thumbnail dir if it doesn't exist. + mkdir -p "$thumbnail_dir" + # Check to see if the thumbnail exists before we do any cropping. if [[ ! -f "$thumbnail_dir/$image_name" ]]; then - # Create the thumbnail dir if it doesn't exist. - mkdir -p "$thumbnail_dir" - # Get image size so that we can do a better crop if [[ -z "$size" ]]; then size="$(identify -format "%w %h" "$image")" @@ -3089,7 +3089,7 @@ get_args() { "--background_color" | "--bg_color") background_color="$2" ;; "--gap") gap="$2" ;; "--clean") - rm -rf "${thumbnail_dir:="$HOME/.cache/thumbnails/neofetch"}" + [[ -d "$thumbnail_dir" ]] && rm -rf "$thumbnail_dir" rm -rf "/Library/Caches/neofetch/" rm -rf "/tmp/neofetch/" exit