tmp=/tmp/out
maim -s -u | tesseract - "$tmp"
# Remove empty lines
sed -ir '/^\s*$/d' "$tmp".txt
copyq add "$(cat "$tmp".txt)"
rm "$tmp".txt
rm "$tmp".txtr
tesseract insists on adding on txt extension and what I assume is some intermediary file txtr, making it awkward to use with mktemp. Probably explained in the manual which I skipped.But like others have said tesseract is not very reliable, at least with default settings -- it's common for it to add extra spaces or various single quotes, or omit spaces.