diff --git a/.config/aerc/paste-attachment.sh b/.config/aerc/paste-attachment.sh index ab822bb8..69d93849 100755 --- a/.config/aerc/paste-attachment.sh +++ b/.config/aerc/paste-attachment.sh @@ -1,18 +1,13 @@ #!/bin/env bash -# if the clipboard is plain/text, we assume it's a path -# otherwise, we assume it's a mime-type to be pasted +# check that clipboard doesn't contain text if wl-paste --list-types | grep -qv '^text/plain$'; then - # clipboard contains a file tempdir=$(mktemp -d) - wl-paste >temp extension=$(grep -E "^$(wl-paste --list-types)" /etc/mime.types | awk '{print $2}') - # echo -n "File name: " >&2 - # read -r user_input - read -e -r -p "$(echo -n "Enter file name (extension .$extension will be appended): " >&2)" user_input + echo -n "Enter file name (extension .$extension will be appended): " >&2 + read -e -r user_input attachment="$tempdir/$user_input.$extension" read -e -r -p "$(printf "Your file will be written to %s and attached. \n\nConfirm (y/n): " "$attachment" >&2)" confirm - # read -e -r -p "$(echo -n "Your file will be written to $attachment and attached. Confirm (y/n): " >&2)" confirm case "$confirm" in y) wl-paste >"$attachment" diff --git a/.config/aerc/temp b/.config/aerc/temp index 677d5bc5..77703cb7 100644 Binary files a/.config/aerc/temp and b/.config/aerc/temp differ