From 1e6804f54af382fa0a176444430461d2e3120a4d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 27 Mar 2017 08:45:12 +1100 Subject: [PATCH] Scrot: Log where the file was saved and fix bug with empty filename --- neofetch | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index 2f397053..6a157658 100755 --- a/neofetch +++ b/neofetch @@ -2518,6 +2518,8 @@ to_off() { take_scrot() { scrot_program "${scrot_dir}${scrot_name}" 2>/dev/null + err "Scrot: Saved screenshot as: ${scrot_dir}${scrot_name}" + [[ "$scrot_upload" == "on" ]] && scrot_upload } @@ -2557,15 +2559,16 @@ scrot_upload() { scrot_args() { scrot="on" - case "$2" in - "-"* | "") ;; - *) - scrot_name="${2##*/}" - scrot_dir="${2/$scrot_name}" - ;; - esac - [[ -z "$@" ]] && scrot_dir="${PWD:+${PWD}/}" + if [[ "$2" =~ \.(png|jpg|jpe|jpeg|gif)$ ]]; then + scrot_name="${2##*/}" + scrot_dir="${2/$scrot_name}" + + elif [[ -d "$2" ]]; then + scrot_dir="$2" + else + scrot_dir="${PWD:+${PWD}/}" + fi } scrot_program() {