From bc0118a759688bd9a9d27d105fd64b7b690342ce Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 25 Jan 2017 11:56:33 +1100 Subject: [PATCH] Ascii: Fix bug where source is an image --- neofetch | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 234c06e0..64010967 100755 --- a/neofetch +++ b/neofetch @@ -2011,11 +2011,18 @@ image_backend() { } get_ascii() { - if [[ ! -f "$image_source" || "$image_source" =~ (auto|ascii) ]]; then + if [[ ! -f "$image_source" || + "$image_source" =~ (auto|ascii) || + "$image_source" =~ \.(png|jpg|jpe|jpeg|gif) ]]; then + # Fallback to distro ascii mode if custom ascii isn't found. [[ ! "$image_source" =~ (auto|ascii) ]] && \ err "Ascii: Ascii file not found, using distro ascii." + # Fallback to distro ascii mode if source is an image. + [[ "$image_source" =~ \.(png|jpg|jpe|jpeg|gif) ]] && \ + err "Image: Source is image file but ascii backend was selected. Using distro ascii." + if [[ -d "/usr/share/neofetch/ascii/distro" ]]; then ascii_dir="/usr/share/neofetch/ascii/distro"