Closed AndreasArvidsson closed 3 months ago
I guess it would also make sense to set it on the request, right? I understand that you use ExcludeClipboardContentFromMonitorProcessing
because you are on Windows. I should probably have different MIME types based on the platform, right?
The issue with setting the MIME type on the response is that I can only make it for manifest v2 (Firefox) because I can use navigator.clipboard.write
. For Chrome and Safari I need to use document.execCommand("copy")
, so there's no way to change the MIME type.
Definitely. In my own fork I only I already set it on the request, but for the public release you definitely show do that Talon side as well.
Probably. I don't know if you should set multiple mime types or one specific per platform.
Annoying, but personally I would prefer to have it on firefox then no browsers. Fortunately for me I am on firefox :)
Can you set multiple mime types with Talon? It doesn't seem possible using navigator.clipboard.write
.
Yes you can. If I can only set one then I suggest you pick one per platform.
Unfortunately navigator.clipboard.write
only allows setting the mime type to "text/plain", "text/html" or "image/png". I will only be able to set the mime type on the request.
The mime types you use in your clipboard manager are for Windows and Mac. Are you aware of one for Linux?
Got it. That is unfortunate.
No
This doesn't work for me:
mime["ExcludeClipboardContentFromMonitorProcessing"] = b"true"
I get the error TypeError: 'builtins.PyMimeData' object does not support item assignment
You need the latest version of Talon beta. Tested on windows and mac at least.
mime = clip.MimeData()
mime.text = text
mime["ExcludeClipboardContentFromMonitorProcessing"] = b"true"
clip.set_mime(mime)
Makes sense. I don't use the beta. I will wait until this is supported in the public version to add it.
You can add it in a try catch then it will work for beta users without giving problems for public?
Ok, I will do that. One question, why do you use byte strings? I looked up what they are but I don't know why you use them here.
The data type on the mime object is bytes not string.
Let me know if it doesn't work as you expect
By setting the appropriate mime type on the clipboard for the response we can make sure that it does not end up in clipboard managers and similar monitoring softwares.
Here is how I do it Talon side. https://github.com/AndreasArvidsson/andreas-talon/blob/e0c7c409b86981789b6152ee26e290fe625e804f/core/edit/edit.py#L158
Note that there are other mime types used on different platforms. Here is what I use in my clipboard manager: https://github.com/AndreasArvidsson/clippy/blob/12a9b4bf5a03a2224e055bc362966892594357fa/src/clipboard.ts#L10-L14