AutoYADM commit: 2025-03-17 23:30:06
This commit is contained in:
parent
f03d12c69c
commit
7bcef9e638
2 changed files with 15 additions and 8 deletions
|
@ -2,12 +2,11 @@
|
||||||
|
|
||||||
# if the clipboard is plain/text, we assume it's a path
|
# if the clipboard is plain/text, we assume it's a path
|
||||||
# otherwise, we assume it's a mime-type to be pasted
|
# otherwise, we assume it's a mime-type to be pasted
|
||||||
TYPE=$(wl-paste --list-types)
|
if wl-paste --list-types | grep -qv '^text/plain$'; then
|
||||||
if "$TYPE" | grep -qv '^text/plain$'; then
|
|
||||||
# clipboard contains a file
|
# clipboard contains a file
|
||||||
tempdir=$(mktemp -d)
|
tempdir=$(mktemp -d)
|
||||||
wl-paste >temp
|
wl-paste >temp
|
||||||
extension=$(grep -E "^$TYPE" /etc/mime.types | awk '{print $2}')
|
extension=$(grep -E "^$(wl-paste --list-types)" /etc/mime.types | awk '{print $2}')
|
||||||
# echo -n "File name: " >&2
|
# echo -n "File name: " >&2
|
||||||
# read -r user_input
|
# read -r user_input
|
||||||
read -r -p "$(echo -n "Enter file name (extension .$extension will be appended): " >&2)" user_input
|
read -r -p "$(echo -n "Enter file name (extension .$extension will be appended): " >&2)" user_input
|
||||||
|
@ -22,15 +21,21 @@ if "$TYPE" | grep -qv '^text/plain$'; then
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
elif "$TYPE" | grep -q '^text/uri-list$' && "$TYPE" | grep -q '^file://'; then
|
|
||||||
# convert URI into standard path
|
|
||||||
echo "hola"
|
|
||||||
else
|
else
|
||||||
# clipboard contains a string (treat as path)
|
# clipboard contains a string (treat as path)
|
||||||
read -r -p "$(echo -n "Your clipboard contains $(wl-paste), which will be attached as a file path. Confirm (y/n): " >&2)" confirm
|
out=$(wl-paste)
|
||||||
|
if wl-paste --list-types | grep -q '^text/uri-list$' && wl-paste | grep -q '^file://'; then
|
||||||
|
echo "URI DETECT"
|
||||||
|
out=${out#file://}
|
||||||
|
fi
|
||||||
|
if [ ! -f "$out" ]; then
|
||||||
|
echo "Your clipboard does not contain a valid file or path!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
read -r -p "$(echo -n "Your clipboard contains $out, which will be attached as a file path. Confirm (y/n): " >&2)" confirm
|
||||||
case "$confirm" in
|
case "$confirm" in
|
||||||
y)
|
y)
|
||||||
wl-paste
|
echo "$out"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exit 1
|
exit 1
|
||||||
|
|
2
.config/aerc/temp
Normal file
2
.config/aerc/temp
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
file:///home/fic/Pictures/gussy.jpg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue