Next: The ‘roam-file’ protocol, Up: Roam Protocol [Contents]
To enable Org-roam’s protocol extensions, you have to add the following to your init file:
(require 'org-roam-protocol)
The instructions for setting up ‘org-protocol=’ are reproduced below.
We will also need to create a desktop application for ‘emacsclient’. The instructions for various platforms are shown below.
For Linux users, create a desktop application in ‘~/.local/share/applications/org-protocol.desktop’:
[Desktop Entry] Name=Org-Protocol Exec=emacsclient %u Icon=emacs-icon Type=Application Terminal=false MimeType=x-scheme-handler/org-protocol
Associate ‘org-protocol://’ links with the desktop application by running in your shell:
xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
To disable the “confirm” prompt in Chrome, you can also make Chrome show a checkbox to tick, so that the ‘Org-Protocol Client’ app will be used without confirmation. To do this, run in a shell:
sudo mkdir -p /etc/opt/chrome/policies/managed/ sudo tee /etc/opt/chrome/policies/managed/external_protocol_dialog.json >/dev/null <<'EOF' { "ExternalProtocolDialogShowAlwaysOpenCheckbox": true } EOF sudo chmod 644 /etc/opt/chrome/policies/managed/external_protocol_dialog.json
and then restart Chrome (for example, by navigating to <chrome://restart>) to make the new policy take effect.
See here for more info on the ‘/etc/opt/chrome/policies/managed’ directory and here for information on the ‘ExternalProtocolDialogShowAlwaysOpenCheckbox’ policy.
For MacOS, one solution is to use Platypus. Here are the instructions for setting up with Platypus and Chrome:
brew cask install platypus
#!/usr/bin/env bash /usr/local/bin/emacsclient --no-wait $1
| 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 |
Inside ‘Settings’:
| Setting | Value | |--------------------------------+----------------| | Accept dropped files | true | | Register as URI scheme handler | true | | Protocol | "org-protocol" |
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 without confirmation. To do this, run in a shell:
defaults write com.google.Chrome ExternalProtocolDialogShowAlwaysOpenCheckbox -bool true
If you’re using Emacs Mac Port, it registered its ‘Emacs.app‘ as the default handler for the URL scheme ‘org-protocol‘. To make ‘OrgProtocol.app’ the default handler instead, run:
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.
Next: The ‘roam-file’ protocol, Up: Roam Protocol [Contents]