HuakunShen / tauri-demo

9 stars 2 forks source link

window.emit sending multiples cur_text #1

Closed m1guer closed 1 month ago

m1guer commented 1 month ago

Hi, im using your code for study and i "create" a version for this to use with wayland and when i copy something the window.emit sends a lot of data. output:

image

HuakunShen commented 1 month ago

If I remember correctly it should only emit when there is a change in clipboard content. Have you tested on other OS? or it's only wayland?

m1guer commented 1 month ago

i just have one way to test, but you can test for me if you want. https://github.com/m1guer/cRopy

HuakunShen commented 1 month ago

If you want to build an app with clipboard monitor, just use the plugin I wrote https://github.com/CrossCopy/tauri-plugin-clipboard

The demo I used in this demo is very inefficient. It's only for demo because it's easier to understand.

tauri-plugin-clipboard uses a more efficient clipboard monitor implementation.

I don't recommend wasting time writing a monitor like what I did in the demo.

m1guer commented 1 month ago

has support for wayland? i tried but no output

image image

HuakunShen commented 1 month ago

It supports wayland. Try the example project in that repo.

m1guer commented 1 month ago

ok!

m1guer commented 1 month ago

image

lol idk what im doing wrong, i follow the example and nothing happens

m1guer commented 1 month ago

image

looks like the plugin is not recognizing the items in clipboard as text or other types

HuakunShen commented 1 month ago

did you try the demo project, does it work?

m1guer commented 1 month ago

no no, i will try with clean react instead of nextjs.

HuakunShen commented 1 month ago

there should be no difference in terms of using this API

m1guer commented 1 month ago

yeah its something related with nextjs.

but now i got this:[Error] clipboard.start_monitor not allowed. Permissions associated with this command: clipboard:allow-start-monitor, clipboard:monitor-all error

HuakunShen commented 1 month ago

If you are using tauri v2 you need to enable the capabilities.

m1guer commented 1 month ago

i active, but now has the same erros, image