Scrot: Log where the file was saved and fix bug with empty filename

This commit is contained in:
Dylan Araps 2017-03-27 08:45:12 +11:00
parent 4659863737
commit 1e6804f54a
1 changed files with 11 additions and 8 deletions

View File

@ -2518,6 +2518,8 @@ to_off() {
take_scrot() { take_scrot() {
scrot_program "${scrot_dir}${scrot_name}" 2>/dev/null scrot_program "${scrot_dir}${scrot_name}" 2>/dev/null
err "Scrot: Saved screenshot as: ${scrot_dir}${scrot_name}"
[[ "$scrot_upload" == "on" ]] && scrot_upload [[ "$scrot_upload" == "on" ]] && scrot_upload
} }
@ -2557,15 +2559,16 @@ scrot_upload() {
scrot_args() { scrot_args() {
scrot="on" 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() { scrot_program() {