Open rpoovey opened 4 years ago
Can you share output of copyq clipboard '?'
command after copying the image?
text/uri-list application/x-copyq-com.apple.icns text/plain application/x-copyq-com.apple.atx image/heic image/vnd.adobe.photoshop application/x-copyq-public.pbm application/x-copyq-public.pvr application/x-copyq-com.ilm.openexr-image image/gif image/jp2 image/jpeg image/heic-sequence image/tiff application/x-copyq-org.khronos.ktx image/png image/bmp image/targa application/x-copyq-org.khronos.astc application/x-copyq-com.microsoft.dds
I have noticed that any image copied from the internet works fine, its only on images stored locally..
I'm guessing that it copied just the file to the clipboard, file path is in text/uri-list
and image/*
contains icon.
For CopyQ to ignore these, you can add an automatic command (here is how to add the command to CopyQ):
[Command]
Automatic=true
Command="
copyq ignore"
Icon=\xf15b
Input=text/uri-list
Name=Ignore Copied Files
If you need to copy the image itself instead of just file path, you could add an automatic command that reads the file content to clipboard when copied.
Hello!
If you need to copy the image itself instead of just file path, you could add an automatic command that reads the file content to clipboard when copied.
Please provide correct command for that issue.
When using copyq with monosnap - monosnap copies images to clipboard files like this. I can paste this only as path if I try to select this from copyq.
I tried use this command https://github.com/hluk/copyq-commands/blob/master/Display/preview-image-files.ini - but it only shows preview, can't extract contents of file to paste it again.
I tried use this command https://github.com/hluk/copyq-commands/blob/master/Display/preview-image-files.ini - but it only shows preview, can't extract contents of file to paste it again.
@glolsh Here is the modified command to copy image file content automatically:
[Command]
Automatic=true
Command="
copyq:
var prefix = 'file://'
var suffixToMime = {
'png': 'image/png',
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'bmp': 'image/bmp',
'svg': 'image/svg+xml',
}
function startsWith(text, what) {
return what === text.substring(0, what.length)
}
function tryCopyImage(mime) {
var text = str(data(mime))
if ( !startsWith(text, prefix) )
return false
var i = text.lastIndexOf('.')
if (i == -1)
return false
var suffix = text.substring(i + 1)
var imageMime = suffixToMime[suffix]
if (imageMime === undefined)
return false
var path = text.substring(prefix.length)
var f = new File(path)
if ( !f.openReadOnly() )
return false
var imageData = f.readAll()
f.close()
if ( imageData.size() === 0 )
return false
setData(mimeItemNotes, path)
setData(imageMime, imageData)
var item = {}
for (var format of dataFormats())
item[format] = data(format)
item[imageMime] = imageData
item[mimeItemNotes] = path
copy(item)
return true
}
tryCopyImage(mimeText)
|| tryCopyImage(mimeUriList)"
Icon=\xf1c5
Name=Copy Image File Content
Copied images on macOS 10.15 dont show.
When I copy a image to clipboard, the preview in CopyQ is just the macOS preview icon for JPEG, if I copy this item back to clipboard and paste, it just pasted the same macOS preview icon for JPEG and not the actual image.