You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
copyq/CopyQ-3.0.2/utils/copy_files.sh

24 lines
489 B

#!/bin/bash
# Save whole files in CopyQ.
# USAGE:
# utils/copy_files.sh [FILES...]
# EXAMPLE:
# TAB=images utils/copy_files.sh ~/Pictures/*.jpg
COPYQ=${COPYQ:-copyq}
TAB=${TAB:-files}
set -e
i=0
for x in "$@"; do
# get MIME
mime=$(file -b -L --mime-type "$x")
# print info
printf "%s: %s\n" "$mime" "$x"
# write image with label
"$COPYQ" -s "$SESSION" tab "$TAB" write $((++i)) \
"application/x-copyq-item-notes" "$x" \
"$mime" - < "$x"
done