I want to copy links really quickly, and Slack doesn’t quite let me do that. If you’re also a link-copier, maybe you found yourself here after thinking, “Surely, there’s a keyboard shortcut available for copying a link to the currently highlighted message in Slack!” Or maybe you Googled “copy link to slack message keyboard shortcut.” Then, hi! I have a ridiculous, over-engineered solution for you, today. 🤓 I’ll show you how to use Keyboard Maestro and its screen recognition engine to add a keyboard shortcut to Slack that will copy the URL for the currently selected message.
If you work at Slack, and you found yourself here after clicking a link from your support folks titled something like “The ridiculous ways people are trying to hack around there not being a keyboard shortcut to copy a deeplink to a message,” then hi! I have a feature request. 😘
I copy a lot of links. Like, a lot, a lot. When I take notes in a meeting, every person’s name is hyperlinked to a note with things that I want to remember about that person. When I add a task to my todo list, reminding me to respond to an email, I include a hyperlink to the message using an AppleScript and then paste it into the quick entry box. Chasing down a difficult bug, I’ll include a hyperlink to the Slack message that started the chase. By densely linking the digital documents in my life, I reduce the memory pressure on my brain. This frees me up to safely forget things that I have trouble remembering anyhow.
If you’ve never tried linking to a Slack message, it’s really handy. Hover your mouse over any message in Slack, click the ︙ menu, and then click “Copy link.” Paste that link somewhere, et. voila, you can now instantly open up the Slack app to that precise message. It’s great if you need to do a thing, and then tell somebody that the thing is done without needing to remember whether they asked for the thing in a channel, or maybe a group DM, or was it in that one thread about something unrelated?
You may have noticed that it’s a tiny bit clunky to copy the link. There’s the whole hovering, searching, clicking, searching, and clicking again thing. There must be a better way!
The “Better” Way to Copy a Link
Software on an open platform is always under your control as the user, eventually. To get around Slack’s lack of a shortcut, we can use Keyboard Maestro and its image recognition engine. Describing how to make Macros takes way longer than just making them. It’s probably easiest to follow along if you download and import an already complete Macro Group.
First, make a new Macro Group in Keyboard Maestro that’s just for Slack. Check the box for “Enable this Macro Group.” Then, change “Available in all applications” to “Available in these applications” and add Slack to the list. This step sets up a group of Macros that will only be triggered when Slack is the active application. This is important because, without that per-app filter, Keyboard Maestro will try to run your macro whenever your press your keyboard shortcut. Sometimes that’s what you want, but not this time.
Next, make a new Macro. A Macro in KM is a collection of actions to take and triggers that will begin those actions. Today, we’ll set up a new keyboard shortcut by clicking “New Trigger” and then selecting “Hot Key Trigger.” Choose any key you like. I use ⌘U.
With a Macro group, a Macro, and a Trigger in place, we just need to add some Actions. Click “New Action” and search the list that pops up for “Found Image.” Double-click “Click at Found Image” or drag it onto the gray outlined area that says “No Actions.” Give Keyboard Maestro an image to look for by opening Slack, hovering over a message, and then taking a screenshot of the ︙ menu. You can capture just the dots by pressing ⌘⇧5 and then using the “Capture Selected Portion” tool. Drag that screenshot onto the Image well in your Found Image Action. When you’re done, you should see something like this.
Give it a try! Open Slack, highlight a message using either the mouse or the keyboard, and then press your keyboard shortcut. You should see your mouse jump over to the ︙ menu and click it. If it doesn’t do that, you may need to adjust the image match precision slider in Keyboard Maestro. That’s the horizontal slider with the clear and fuzzy lowercase e on either end of it. If KM isn’t matching something you think it should be, drag the slider a bit more towards the fuzzy e. If it’s clicking the wrong thing sometimes, drag it a bit more toward the clear e.
Adding a Pause
On to the good stuff. Make another “Click at Found Image” action, this time using a screenshot of the “Copy link” button from Slack. This might be enough for you, but you’re probably going to want to insert one more Action: “Pause Until Conditions are Met.” Keyboard Maestro is fast, sometimes a bit too fast. Depending on how quickly things happen on your Mac, KM might click the ︙ menu, and then look for the Copy Link button before it’s appeared. That will make your Macro feel unreliable, which will make you use it less, which will make it a waste of time.
To make your Macro more like 100% reliable, add a “Pause Until Conditions are Met” Action between your two “Click at Found Image” actions. Click “Add Condition” and then add a “Found Image Condition.” Drag your Copy Link screenshot into the image well in that condition, mess with the fuzzy e-slider if you need to, and then you’re done!
The Actual Better Way
☝️ That process was silly. There is no reason a stable piece of software like Slack should require automation using screen recognition. Software can and should be better about letting users take the actions they want to take using the input methods available to them.
I say it should be better, not just because it lets whiny nerds like me copy links one microsecond faster, but because software can and should let all users decide how they want to interact. It should empower users to create their own experience, not limit them to the input decisions that make sense to a random developer or designer at Slack.
A user with limited mobility should not need a $36 piece of general-purpose automation software like Keyboard Maestro to automate an action that, under the hood, is already capable of being set to any arbitrary keyboard shortcut. If your devs can set up a keyboard shortcut, then your users should be able to as well.