AutoYADM commit: 2025-03-17 23:45:07

This commit is contained in:
Daniel Fichtinger 2025-03-17 23:45:07 -04:00
parent 7bcef9e638
commit 7e6b0ace06
3 changed files with 6 additions and 5 deletions

View file

@ -157,6 +157,7 @@ $ex = <C-x>
# view # view
$noinherit = true $noinherit = true
$ex = <C-x> $ex = <C-x>
# $ex = :
$complete = <C-o> $complete = <C-o>
# <C-Enter> = :toggle-key-passthrough<Enter> # <C-Enter> = :toggle-key-passthrough<Enter>
<C-r> = :reload<Enter> <C-r> = :reload<Enter>

View file

@ -9,9 +9,10 @@ if wl-paste --list-types | grep -qv '^text/plain$'; then
extension=$(grep -E "^$(wl-paste --list-types)" /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 -e -r -p "$(echo -n "Enter file name (extension .$extension will be appended): " >&2)" user_input
attachment="$tempdir/$user_input.$extension" attachment="$tempdir/$user_input.$extension"
read -r -p "$(echo -n "Your file will be written to $attachment and attached. Confirm (y/n): " >&2)" confirm 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 case "$confirm" in
y) y)
wl-paste >"$attachment" wl-paste >"$attachment"
@ -25,14 +26,13 @@ else
# clipboard contains a string (treat as path) # clipboard contains a string (treat as path)
out=$(wl-paste) out=$(wl-paste)
if wl-paste --list-types | grep -q '^text/uri-list$' && wl-paste | grep -q '^file://'; then if wl-paste --list-types | grep -q '^text/uri-list$' && wl-paste | grep -q '^file://'; then
echo "URI DETECT"
out=${out#file://} out=${out#file://}
fi fi
if [ ! -f "$out" ]; then if [ ! -f "$out" ]; then
echo "Your clipboard does not contain a valid file or path!" >&2 read -e -r -p "$(printf "Your clipboard contains %s, which is not a valid attachment. \n\nPress enter to continue." "$out" >&2)"
exit 1 exit 1
fi fi
read -r -p "$(echo -n "Your clipboard contains $out, which will be attached as a file path. Confirm (y/n): " >&2)" confirm 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 case "$confirm" in
y) y)
echo "$out" echo "$out"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 B

After

Width:  |  Height:  |  Size: 76 KiB

Before After
Before After