Skip to content

Instantly share code, notes, and snippets.



Forked from mfilej/Info.plist
Last active May 20, 2020
What would you like to do?
Make Safari open links from other applications in current space

As a prerequisite, you'll need to install the RCDefaultApp preference pane

Open AppleScript Editor and paste in content of _Script.scpt

Save the document using file format Application, and select the Stay Open checkbox. Name it SafariURLHelper. I have an Applications folder in my home directory in which I saved it. Using the Finder, navigate to where you saved SafariURLHelper, then Control-click its icon and select Show Package Contents from the contextual menu. Inside the Contents folder, find Info.plist, and open it in a text editor.

Add content of Info.plist to the bottom of the file, just before the closing and tags

If you had already run the script without this improvement, quit it using "Activity". You can also update the saved Helper app in Script Editor without the need to edit the Info.plist again - our changes are preserved.

on open location theURL
tell application "System Events"
if (count of windows of process "Safari") = 0 then
tell application "Safari" to make new document
tell application "Safari" to set the URL of the front document to theURL
tell application "Safari" to open location theURL
end if
end tell
tell application "Safari" to activate
end open location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment