hluk / hluk/CopyQ

extremely lag when handle screenshot captured by spectacle and call hasClipboardFormat('image/png')

Open
#2,377 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
12.3k
Forks
593
Avg merge
2d 8h
Merged PRs (30d)
9

Description

Before creating a new issue, see list of [known
issues](https://copyq.readthedocs.io/en/latest/known-issues.html).

**Describe the bug**
when I write a script to handle screenshot captured by [KDE spectacle](https://apps.kde.org/zh-cn/spectacle/), I found it is extremely lag once I called `hasClipboardFormat('image/png')`.

**To Reproduce**
Steps to reproduce the behavior:

1. write a automatic script like `serverLog(hasClipboardFormat('image/png'))`
2. make a screenshot using spectacle. It is more noticeable if the screenshot resolution is high.
3. press the buttom `copy to clipboard`
4. notice the huge lag.

# another minor problem

It is also kinda weired if I call
```
var format = dataFormats()
for (var i in format){
serverLog(format[i])
}
```
with spectacle screenshot, it only print out 4 types (3 copyq and one ''image/png"), however if I call `hasClipboardFormat('image/avif')` it returns true.

code:
```
copyq:
if (isClipboard()) {
var format = dataFormats()
for (var i in format) {
serverLog(format[i])
}
serverLog(format.length)
serverLog(currentWindowTitle())
serverLog('haspng')
serverLog(hasClipboardFormat('image/png'))
serverLog('hasavif')
serverLog(hasClipboardFormat('image/avif'))
}
```
result:
```
Note: application/x-copyq-current-tab
Note: application/x-copyq-output-tab
Note: application/x-copyq-owner-window-title
Note: image/png
Note: 4 // there are more than 4 types. see screenshot below
Note:
Note: haspng
Note: true
Note: hasavif
Note: true
```

**Expected behavior**

there should't be that huge lag.

and since it has `image/avif` format it should include in the `dataFormats()`.

the existance of `image/avif` content can be verified with `qdbus org.kde.KWin /KWin org.kde.KWin.showDebugConsole`:

![图片](https://github.com/hluk/CopyQ/assets/15712263/ce067058-50a8-49cf-a9c5-8a8d32f86530)

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Version, OS and Environment**
CopyQ Clipboard Manager 6.4.0
Qt: 5.15.8
KNotifications: 5.101.0
Compiler: GCC
Arch: x86_64-little_endian-lp64
OS: Debian GNU/Linux 12 (bookworm)

**Additional context**
KDE with wayland

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.