Files
org-roam/manual/Installation-_00281_0029.html
2020-06-12 09:15:50 +00:00

198 lines
8.3 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2020-2020 Jethro Kuan <jethrokuan95@gmail.com>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any
later version.
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Installation (1) (Org-roam User Manual)</title>
<meta name="description" content="Installation (1) (Org-roam User Manual)">
<meta name="keywords" content="Installation (1) (Org-roam User Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Roam-Protocol.html#Roam-Protocol" rel="up" title="Roam Protocol">
<link href="The-roam_002dfile-protocol.html#The-roam_002dfile-protocol" rel="next" title="The roam-file protocol">
<link href="_005f.html#g_t_005f" rel="prev" title="_">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="assets/page.css">
</head>
<body lang="en">
<a name="Installation-_00281_0029"></a>
<div class="header">
<p>
Next: <a href="The-roam_002dfile-protocol.html#The-roam_002dfile-protocol" accesskey="n" rel="next">The &lsquo;<samp>roam-file</samp>&rsquo; protocol</a>, Previous: <a href="_005f.html#g_t_005f" accesskey="p" rel="prev">_</a>, Up: <a href="Roam-Protocol.html#Roam-Protocol" accesskey="u" rel="up">Roam Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="Installation-2"></a>
<h3 class="section">12.2 Installation</h3>
<p>To enable Org-roam&rsquo;s protocol extensions, you have to add the following to your init file:
</p>
<div class="lisp">
<pre class="lisp">(require 'org-roam-protocol)
</pre></div>
<p>The instructions for setting up &lsquo;<samp>org-protocol=</samp>&rsquo; are reproduced below.
</p>
<p>We will also need to create a desktop application for &lsquo;<samp>emacsclient</samp>&rsquo;. The
instructions for various platforms are shown below.
</p>
<p>For Linux users, create a desktop application in &lsquo;<samp>~/.local/share/applications/org-protocol.desktop</samp>&rsquo;:
</p>
<div class="example">
<pre class="example">[Desktop Entry]
Name=Org-Protocol
Exec=emacsclient %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol
</pre></div>
<p>Associate &lsquo;<samp>org-protocol://</samp>&rsquo; links with the desktop application by
running in your shell:
</p>
<div class="example">
<pre class="example">xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol
</pre></div>
<p>To disable the &ldquo;confirm&rdquo; prompt in Chrome, you can also make Chrome
show a checkbox to tick, so that the &lsquo;<samp>Org-Protocol Client</samp>&rsquo; app will be used
without confirmation. To do this, run in a shell:
</p>
<div class="example">
<pre class="example">sudo mkdir -p /etc/opt/chrome/policies/managed/
sudo tee /etc/opt/chrome/policies/managed/external_protocol_dialog.json &gt;/dev/null &lt;&lt;'EOF'
{
&quot;ExternalProtocolDialogShowAlwaysOpenCheckbox&quot;: true
}
EOF
sudo chmod 644 /etc/opt/chrome/policies/managed/external_protocol_dialog.json
</pre></div>
<p>and then restart Chrome (for example, by navigating to &lt;chrome://restart&gt;) to
make the new policy take effect.
</p>
<p>See <a href="https://www.chromium.org/administrators/linux-quick-start">here</a> for more info on the &lsquo;<samp>/etc/opt/chrome/policies/managed</samp>&rsquo; directory and
<a href="https://cloud.google.com/docs/chrome-enterprise/policies/?policy=ExternalProtocolDialogShowAlwaysOpenCheckbox">here</a> for information on the &lsquo;<samp>ExternalProtocolDialogShowAlwaysOpenCheckbox</samp>&rsquo; policy.
</p>
<p>For MacOS, one solution is to use <a href="https://github.com/sveinbjornt/Platypus">Platypus</a>. Here are the instructions for
setting up with Platypus and Chrome:
</p>
<ol>
<li> Install and launch Platypus (with <a href="https://brew.sh/">Homebrew</a>):
</li></ol>
<div class="example">
<pre class="example">brew cask install platypus
</pre></div>
<ol>
<li> Create a script &lsquo;<samp>launch_emacs.sh</samp>&rsquo;:
</li></ol>
<div class="example">
<pre class="example">#!/usr/bin/env bash
/usr/local/bin/emacsclient --no-wait $1
</pre></div>
<ol>
<li> Create a Platypus app with the following settings:
</li></ol>
<div class="example">
<pre class="example">| Setting | Value |
|--------------------------------+---------------------------|
| App Name | &quot;OrgProtocol&quot; |
| Script Type | &quot;env&quot; · &quot;/usr/bin/env&quot; |
| Script Path | &quot;path/to/launch-emacs.sh&quot; |
| Interface | None |
| Accept dropped items | true |
| Remain running after execution | false |
</pre></div>
<p>Inside &lsquo;<samp>Settings</samp>&rsquo;:
</p>
<div class="example">
<pre class="example">| Setting | Value |
|--------------------------------+----------------|
| Accept dropped files | true |
| Register as URI scheme handler | true |
| Protocol | &quot;org-protocol&quot; |
</pre></div>
<p>To disable the &ldquo;confirm&rdquo; prompt in Chrome, you can also make Chrome
show a checkbox to tick, so that the &lsquo;<samp>OrgProtocol</samp>&rsquo; app will be used
without confirmation. To do this, run in a shell:
</p>
<div class="example">
<pre class="example">defaults write com.google.Chrome ExternalProtocolDialogShowAlwaysOpenCheckbox -bool true
</pre></div>
<p>If you&rsquo;re using <a href="https://github.com/railwaycat/homebrew-emacsmacport">Emacs Mac Port</a>, it registered its &lsquo;Emacs.app&lsquo; as the default
handler for the URL scheme &lsquo;org-protocol&lsquo;. To make &lsquo;<samp>OrgProtocol.app</samp>&rsquo;
the default handler instead, run:
</p>
<div class="example">
<pre class="example">defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add \
'{&quot;LSHandlerPreferredVersions&quot; = { &quot;LSHandlerRoleAll&quot; = &quot;-&quot;; }; LSHandlerRoleAll = &quot;org.yourusername.OrgProtocol&quot;; LSHandlerURLScheme = &quot;org-protocol&quot;;}'
</pre></div>
<p>Then restart your computer.
</p>
<hr>
<div class="header">
<p>
Next: <a href="The-roam_002dfile-protocol.html#The-roam_002dfile-protocol" accesskey="n" rel="next">The &lsquo;<samp>roam-file</samp>&rsquo; protocol</a>, Previous: <a href="_005f.html#g_t_005f" accesskey="p" rel="prev">_</a>, Up: <a href="Roam-Protocol.html#Roam-Protocol" accesskey="u" rel="up">Roam Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
</body>
</html>