← All Notes

A hacky Notion web-clipper for Safari

The day Notion decided to go free-forever I moved 4 years worth of my notes, annotated articles and a slew of other miscellaneous things from Evernote into it. Spent the next week "organizing" my Notion and loving every minute of it.

Just one small problem. My browser of choice for everyday surfing is Safari.

And Notion STILL doesn't have a Safari extension 😤

Workaround

I'd been doing this for the past few months now, but didn't really dwell on it too much until Madhuri recently brought it back up to my headspace. Anyways, my jugaad workaround went:

  1. Come across article in Safari
  1. Press keyboard shortcut
  1. Send article to Notion
    1. Copy URL from Safari
    2. Open and paste in Chrome
    3. Use Notion's Chrome webclipper to save URL
    4. Close Chrome
    5. Switch back to Safari

Simple enough, but Point 3 was a huge pain to do manually. If only someone were to automate it...

Automate, how?

A quick Google search on system automation introduces me to two weapons to win this fight with:

  1. Automator: A handy utility to automate select Mac apps.
  1. Applescript: A scripting language built for inter-application comms via "Apple Events", which apparently includes keyboard and mouse commands. Neat!

So here's an Applescript snippet I wrote that does exactly what we described in 3. You can use this snippet in an Automator recipe and can trigger it with the press of a key-combo (I set mine to CMD ⌘ + SHIFT ⇧ + K)

# previous task returns url of current safari tab as input

on run {input, parameters}
	tell application "Google Chrome" to open location input

	# should wait for complete page to load here
	# delay 10

	tell application "Google Chrome" to activate
	tell application "Google Chrome"
		repeat until (loading of front window's tab 1 is false)
			1 + 1
		end repeat
		loading of front window's tab 1
	end tell
	
	tell application "System Events"
		keystroke "k" using {command down, shift down}
		delay 1
		keystroke return
		delay 1
	end tell
	
	tell application "Safari" to activate
	tell application "Google Chrome" to quit
	return input
end run

^ I used Chrome above, but you could easily achieve the same via Firefox too if you tweak the code.

Hopefully now that the latest Safari has support for the Web Extensions API, we'll see an official web-clipper soon, since this is still not the most elegant solution.

Thanks for reading!