talonvoice / talon

Issue Tracker for the main Talon app
85 stars 0 forks source link

clip.MimeData adds multiple Mac pasteboard items #642

Closed nriley closed 11 months ago

nriley commented 1 year ago

I'm implementing an action that copies a link to a URL as RTF, with (e.g.) a web page title as the link text.

I'd like it to also include the text of the URL so pasting in a destination app that doesn't support RTF still preserves the URL. But when I do this, Talon adds the text as a 2nd pasteboard item, rather than an alternative data type for the first item.

Here's an example with HTML (as the syntax is a bit easier to parse than RTF).

>>> x = clip.MimeData()
>>> x.html = '<a href="https://talonvoice.com/">Talon</a>'
>>> x.text = 'https://talonvoice.com/'
>>> clip.set_mime(x)

This is what it looks like in Pasteboard Viewer:

image

And if I paste into (say) TextEdit, I get both items together:

https://talonvoice.com/ Talon

It would be more helpful if clip.MimeData added multiple data types (e.g., plain text, HTML, RTF) to a single NSPasteboardItem as alternatives, like this:

image
lunixbochs commented 11 months ago

fixed in next beta