AutoYADM commit: 2025-03-25 23:30:07
This commit is contained in:
parent
eb8eb64872
commit
ed19a33568
2 changed files with 2 additions and 81 deletions
|
@ -1,39 +0,0 @@
|
|||
#!/bin/env bash
|
||||
|
||||
# check that clipboard doesn't contain text
|
||||
if wl-paste --list-types | grep -qv '^text/plain$'; then
|
||||
tempdir=$(mktemp -d)
|
||||
extension=$(grep -E "^$(wl-paste --list-types)" /etc/mime.types | awk '{print $2}')
|
||||
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
|
||||
case "$confirm" in
|
||||
y)
|
||||
wl-paste >"$attachment"
|
||||
echo "$attachment"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# clipboard contains a string (treat as path)
|
||||
out=$(wl-paste)
|
||||
if wl-paste --list-types | grep -q '^text/uri-list$' && wl-paste | grep -q '^file://'; then
|
||||
out=${out#file://}
|
||||
fi
|
||||
if [ ! -f "$out" ]; then
|
||||
read -e -r -p "$(printf "Your clipboard contains %s, which is not a valid attachment. \n\nPress enter to continue." "$out" >&2)"
|
||||
exit 1
|
||||
fi
|
||||
read -e -r -p "$(printf "Your clipboard contains %s, which will be attached as a path. \n\nConfirm (y/n): " "$out" >&2)" confirm
|
||||
case "$confirm" in
|
||||
y)
|
||||
echo "$out"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
1
.config/aerc/paste-attachment.sh
Symbolic link
1
.config/aerc/paste-attachment.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/fic/dev/mail-utils/paste-attachment.sh
|
Loading…
Add table
Add a link
Reference in a new issue