wiiznokes / clipboard-manager

Clipboard manager for COSMICâ„¢
GNU General Public License v3.0
39 stars 3 forks source link

Add private mode #8

Closed leb-kuchen closed 5 months ago

leb-kuchen commented 5 months ago

Quick and easy solution.

wiiznokes commented 5 months ago

Thanks for the contribution, i will try to review

wiiznokes commented 5 months ago

The PR looks good otherwise.

I plan to add a window to list all settings. In the meantime, i would prefer is the applet was not to cluttered, so please, can you remove the toggle ?

Edit: incognito should be a quick settings anyway, so i guess we can leave the toggle for now. Maybe in the future, we could open a quick settings page when we right-click the icon.

Also, it seems that activate incognito stop the copy of elements to works. This will not block the merge but maybe you know how to fix it.

leb-kuchen commented 5 months ago

If you comment out output.send(ClipboardMessage::Data(data)).await.unwrap(); ( line 62), you cannot copy. The pipe reader is probably behind some mutex or is not not dropped.

wiiznokes commented 5 months ago

Idk, it's weird, it's like the source of to clipboard get automatically dropped:

[src/clipboard.rs:92:5] "copy" = "copy"
[src/clipboard.rs:92:5] &data = Data {
    creation: 1712669578196,
    mime: "text/plain;charset=utf-8",
    value: "send",
}
on_close_requested
[2024-04-09T13:42:33Z INFO  wl_clipboard_rs::paste_watch] keyboard is empty
[2024-04-09T13:42:33Z ERROR cosmic_clipboard_manager::clipboard] watch clipboard error: The clipboard of the requested seat is empty

But the copy function work well if incognito is disabled:

[src/clipboard.rs:92:5] "copy" = "copy"
[src/clipboard.rs:92:5] &data = Data {
    creation: 1712669578196,
    mime: "text/plain;charset=utf-8",
    value: "send",
}
[2024-04-09T13:49:05Z INFO  cosmic_clipboard_manager::clipboard] sending data to database: Data { creation: 1712670545966, mime: "text/plain;charset=utf-8", value: "send" }

That make no sense to me

wiiznokes commented 5 months ago

What's weird it that the error happens in the start_watching function, where no code has been changed.

wiiznokes commented 5 months ago

This is the real error: ERROR wl_clipboard_rs::copy] Paste(Copy(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }))

leb-kuchen commented 5 months ago

It it just calling db insert and weird things are happening there.

leb-kuchen commented 5 months ago

I guess start watching listens for the copy, because it is also a clipboard event.

leb-kuchen commented 5 months ago

This should do it, the only real data there still is the last creation date, though you could also fake it, but this will likely cause problems. I also made adjustments to the padding of the clear button and the width of the search input, if you don't mind it.

wiiznokes commented 5 months ago

I fixed it in clipboard-rs. Thank again for the contribution