CleanLinks icon indicating copy to clipboard operation
CleanLinks copied to clipboard

Possible to integrate copying clean links into browser's default copy action?

Open e-t-l opened this issue 2 years ago • 2 comments

I'm not 100% sure if this is possible, but there might be a way to make copying a link clean it automatically, rather than needing a separate "Copy clean link" context menu item. If it's possible to intercept—or at least detect—a clipboard-write event (Google Docs does this with JS, so I think a webextension might be able to as well), then when the user copies something using CTRL+C or right-click>Copy, CL could parse the copied object, and if it's a valid hyperlink that can be cleaned, clean it and send its own clipboard-write event with the cleaned hyperlink. Think it would work?

e-t-l avatar Oct 29 '21 15:10 e-t-l

I think it’s technically possible, but do we want to do it?

  • It’s probably requiring more permissions
  • We’ll now need to examine anything going to the clipboard rather than just what we’re asked to clean
  • Can’t get the original link without editing you whitelist rules, if you want it uncleaned (either once, or always if the cleaning is misfiring)
  • Is the current solution of an extra entry in the context menu, just on links, too invasive?

Cimbali avatar Oct 29 '21 16:10 Cimbali

Fair enough. I'm one of those people who likes to have as few items cluttering my context menu as possible, and computer things that work as efficiently as possible. So, including an option in CL's settings to do this appealed to me. To address your points individually...

It’s probably requiring more permissions

Yeah, probably

We’ll now need to examine anything going to the clipboard rather than just what we’re asked to clean

Possibly. If we limit it to links copied from context menu, it may be the case that "Copy link" is unique from the generic "Copy" event.

Can’t get the original link without editing you whitelist rules, if you want it uncleaned

If this functionality is controlled by a checkbox on the Options page, it would actually be as simple as unchecking that checkbox and reloading the webpage in question. To your point, though, it is still more work

Is the current solution of an extra entry in the context menu, just on links, too invasive

Not "too invasive" at all. As mentioned above, this is just me being a perfectionist. Totally understand if you want to reject this idea. Just thought I'd float it by you, since I don't think I have the programming experience to go at it alone.

e-t-l avatar Oct 29 '21 16:10 e-t-l