Copy URLs from Safari or Chrome with a keyboard shortcut
I really love the Arc Browser, but after last week’s major security incident, I wanted to look at some alternatives. They did a hundred little things to make it the most polished web browser I have ever used and I will definitely miss it.
Anyway, I went back to Safari and its many paper cuts. I got used to most of the quirks, but I would end up pressing ⌘ ⇧ C a dozen times daily to copy the URL, only to be presented with a very silly element selection feature in dev tools, which I never need.
I figured it would be easier to fix the browser than retrain my muscle memory, and thankfully, there are enough knobs built into macOS to make this not so painful.
Step 1: Write some Apple Script.
I found the rough template on reddit, which I didn’t have to tweak much except disabling the conflicting keybinding.
- Create a new service in Automation.app
- Select Safari.app, with “workflow receives” set to “no input”.
- Use the following AppleScript1 code, and save it with a name like “Copy Safari URL”.
on run {input, parameters}
tell application "Safari"
set theURL to URL of front document
set the clipboard to theURL
end tell
end run
Step 2: Enable the keybinding in keyboard settings.
Settings > Keyboard > Keyboard Shortcuts > Services > General
Step 3: Disable the conflicting command
Found the basic idea of disabling inbuilt shortcuts from this StackOverflow post. You find the exact name of the command you want to disable (‘Start Element Selection’), and rebind it to something completely different.
Settings > Keyboard > Keyboard Shortcuts > App Shortcuts > Safari
🎉 📋 Happy Copy Pasting
Update 1: Ditched Safari, went back to Chrome
Safari’s paper cuts add up, and it’s time to give Chrome another try.
- Safari does not respect “Always open tabs instead of windows” consistently, it’s infuriating.
- Safari’s vertical tabs implementation is still an alpha product.
- Tab groups are also a good idea, but the implementation is still pretty rough.
- The tab sync across devices (iPad & iPhone) is pretty neat though! Will miss it.
Update 2: Ditched Chrome, went back to Arc again
- My daily driver is a LG 27” 5K monitor and no website really needs more than ~1200px. That’s about half of the available horizontal width. Vertical tabs are so essential for me on desktop, and Arc has the best implementation that I know of.
- I tried to update the shortcut on Chrome as well, but couldn’t disable the conflicting inbuilt command. The shortcut is documented here, but the exact command string isn’t.
End of the day, Arc is easily the most polished desktop browser experience on macOS. They seem to be trying to resolve the incident from last week as best as they can, so I’m willing to give them another chance.
🌈 Back to Arc again! Here is my 🎟️ invite code if you want to give it a try.
-
AppleScript must be the most bizarre and quirky programming language ever invented. I can write code in over a dozen programming languages but AppleScript is the most incomprehensible of them all. ↩