The Robservatory

Robservations on everything…

 

Copy links in Chrome, Firefox, and Safari in one step

Something I do a lot is copy links—whether for articles here, or for pasting into Messages or Signal or Twitter, or for corresponding with Many Tricks' customers, I copy a lot of links.

Web browsers—at least the "big three" of Chrome, Firefox, and Safari—bury their copy link commands in a contextual menu. If I want to copy a link, it's a right-click and then either using the keyboard (press C then Return in Chrome and Safari) or mouse (Firefox) to select then activate the Copy Link command.

If you use Chrome or Firefox as your browser, you're in luck: You can install a simple extension in each that lets you copy a link by simply hovering over the link and pressing Commmand- or Control-C:

Now, about Safari. I couldn't find a Safari extension to handle this seemingly simple task, so I turned to Keyboard Maestro.

A Copy Link macro is relatively straightforward in Keyboard Maestro—it just needs to open the contextual menu and activate the Copy Link action. Here's my finished four-command macro:

I'm not going to bother uploading this one as it's so simple. The only thing you may need to adjust is the Pause line—without some delay, the next command will execute before the contextual menu appears, so nothing will happen (because "C" doesn't do anything if there's no menu there). Four hundredths of a second was the shortest delay that worked on my iMac; you may have to change this value for your particular Mac.

I added this macro to my Safari macro group, which is only active when Safari or Safari Technology Preview are active. Now I can copy Safari links with a simple Control-C; there's a momentary flash of the contextual menu, but it's worth it for the improved speed and ease of use. So much better!

3 Comments

Add a Comment
  1. Keyboard Maestro has Tokens for things like Front Browser URL, Front Browser Title as well as dedicated ones for Safari and Chrome so you can use %SafariURL% to get URLs without any copy / pasting.
    I have a 3-step KM macro that expands the typed string ';md' to give me a Markdown link from the front window of Safari. eg: [Copy links in Chrome, Firefox, and Safari in one step | The Robservatory](https://robservatory.com/copy-links-in-chrome-firefox-and-safari-in-one-step/)

    1. Thanks for that tip—I'd never realized that!

      Edit: While useful in other situations, I just realized this won't help me in this case: I'm not after the URL of the frontmost window, I want the URL of a link that's on that page.

      -rob.

  2. Ah, I misunderstood. I also use an action in Automator which finds URLs in selected text. Handy in certain cases but wouldn’t be better than what you have and I find Automator slow compared to KM.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Robservatory © 2020 • Privacy Policy Built from the Frontier theme