From 99c82b0fc14fc9da6fbfc7a82b9536556b6e3438 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Sat, 30 Apr 2022 12:07:34 +0200 Subject: [PATCH] Add Applescript code to register org-protocol on Darwin --- README.org | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.org b/README.org index e730f6d..a12b1b3 100644 --- a/README.org +++ b/README.org @@ -776,6 +776,10 @@ may hang or die. #+end_src ** TODO Look into: org-protocol handling with other browser on Darwin +:PROPERTIES: +:CUSTOM_ID: sec:org-protocol-darwin +:END: + 1. [[http://rwx.io/posts/osx-uri-protocol-handler/][Patrick Goddi: macOS URI protocol handler]] and his [[https://github.com/fooqri/uri-handler][URI-Handler]]. 2. [[https://www.hammerspoon.org/][Hammerspoon]] 3. [[https://vritser.github.io/posts/capture-anywhere/][Emacs Capture Anywhere]] @@ -787,6 +791,31 @@ may hang or die. (when (ensure-package-installation 'applescript-mode)) #+end_src +#+caption[Applescript code to register =org-protocol= on Darwin]: +#+caption: Applescript code to register =org-protocol= on Darwin. +#+name: lst:applescript-org-protocol +#+begin_src applescript :tangle no + on emacsclient(input) + do shell script "/usr/local/bin/emacsclient -n -c '" & input & "'" + tell application "Emacs" to activate + end emacsclient + + on open location input + emacsclient(input) + end open location + + on open inputs + repeat with raw_input in inputs + set input to POSIX path of raw_input + emacsclient(input) + end repeat + end open + + on run + do shell script emacsclient("") + end run +#+end_src + * Completion :PROPERTIES: :CUSTOM_ID: sec:completion