AutoYADM commit: 2025-03-18 00:00:07

This commit is contained in:
Daniel Fichtinger 2025-03-18 00:00:07 -04:00
parent 7e6b0ace06
commit ddffd6bcf6
2 changed files with 3 additions and 8 deletions

View file

@ -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"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 173 KiB

Before After
Before After