diff --git a/doc/roam_protocol.md b/doc/roam_protocol.md index af86ff4..ad86880 100644 --- a/doc/roam_protocol.md +++ b/doc/roam_protocol.md @@ -95,8 +95,7 @@ policy. ## Mac OS -One solution to this, recommended in [Issue -#115](https://github.com/jethrokuan/org-roam/issues/115), is to use +One solution is to use [Platypus](https://github.com/sveinbjornt/Platypus). Here are the instructions for setting up with Platypus and Chrome: @@ -105,17 +104,24 @@ instructions for setting up with Platypus and Chrome: ```sh brew cask install playtpus ``` +2. Create a script `launch_emacs.sh`: -2. Platypus settings: +``` +#!/usr/bin/env bash +/usr/local/bin/emacsclient --no-wait $1 +``` + +2. Create a Platypus app with the following settings: + +| Setting | Value | +|--------------------------------+---------------------------| +| App Name | "OrgProtocol" | +| Script Type | "env" ยท "/usr/bin/env" | +| Script Path | "path/to/launch-emacs.sh" | +| Interface | None | +| Accept dropped items | true | +| Remain running after execution | false | -- App Name: `OrgProtocol` -- Script Type: `env` and `/usr/bin/env` -- Script Path: `/path/to/emacsclient $1` -- Tick Accept dropped items and click Settings -- Tick Accept dropped files -- Tick Register as URI scheme handler -- Add `org-protocol` as a protocol -- Create the app To disable the "confirm" prompt in Chrome, you can also make Chrome show a checkbox to tick, so that the `OrgProtocol` app will be used @@ -125,4 +131,20 @@ without confirmation. To do this, run in a shell: defaults write com.google.Chrome ExternalProtocolDialogShowAlwaysOpenCheckbox -bool true ``` + +##### Note for Emacs Mac Port + +If you're using [Emacs Mac Port](https://github.com/railwaycat/homebrew-emacsmacport), it +registered its `Emacs.app` as the default handler for the URL scheme +`org-protocol`. We have to make our `OrgProtocol.app` the default +handler instead (replace `org.yourusername.OrgProtocol` with your app +identifier): + +``` +$ defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \ +'{"LSHandlerPreferredVersions" = { "LSHandlerRoleAll" = "-"; }; LSHandlerRoleAll = "org.yourusername.OrgProtocol"; LSHandlerURLScheme = "org-protocol";}' +``` + +Then restart your computer. + [org-protocol-inst]: https://orgmode.org/worg/org-contrib/org-protocol.html