I know firefox has the very useful “Copy clean Link” option in the context menu, but I would like a similar feature for copying links from any other software, like spotify for example. So I am looking for some software that hooks into the clipboard pipeline, and cleans any URL that gets added. I tried googling for something like it, but was completely unsuccessful. Does anyone have a clue how I might go about achieving this?

Thanks in advance :)

Edit: I found out about klipper’s actions, which provide the option to run a command when a string that matches a regex is added to the clipboard buffer. I am not sure how to properly use this though, so any help is appreciated!

  • silly goose meekah@lemmy.worldOP
    link
    fedilink
    arrow-up
    0
    ·
    23 hours ago

    Fair enough, I haven’t given that too much thought myself until now. After playing around with Firefox’s URL cleaning, I realized there are some parameters I want to keep. So, by clean I mean removing all unnecessary parameters in the URL.

    For example, https://youtu.be/jNQXAC9IVRw would become https://youtu.be/jNQXAC9IVRw, but https://www.youtube.com/watch?v=jNQXAC9IVRw keeps it’s parameter, because it is necessary.

    I guess replicating the logic for deciding which parameters to keep is not trivial, so the easiest solution is probably just manually pasting links into firefox, and just copying them cleanly from there. Thanks for providing some code, though!