├── .gitignore ├── Org Protocol Handler.app └── Contents │ ├── Info.plist │ ├── MacOS │ └── applet │ ├── PkgInfo │ └── Resources │ ├── Scripts │ └── main.scpt │ ├── applet.icns │ ├── applet.rsrc │ ├── description.rtfd │ └── TXT.rtf │ └── parse.py └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleAllowMixedLocalizations 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | applet 11 | CFBundleIconFile 12 | applet 13 | CFBundleIdentifier 14 | com.apple.ScriptEditor.id.Org-Protocol-Handler 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | Org Protocol Handler 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | aplt 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleURLName 29 | EmacsClientCapture 30 | CFBundleURLSchemes 31 | 32 | org-protocol 33 | 34 | 35 | 36 | LSMinimumSystemVersionByArchitecture 37 | 38 | x86_64 39 | 10.6 40 | 41 | LSRequiresCarbon 42 | 43 | WindowState 44 | 45 | bundleDividerCollapsed 46 | 47 | bundlePositionOfDivider 48 | 0.0 49 | dividerCollapsed 50 | 51 | eventLogLevel 52 | 1 53 | name 54 | ScriptWindowState 55 | positionOfDivider 56 | 686 57 | savedFrame 58 | 717 95 1046 1007 0 0 2560 1417 59 | selectedTab 60 | log 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/MacOS/applet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronbieber/org-protocol-handler/5f4927b7c6b07d553b4b792e0f0b54985d63bf8b/Org Protocol Handler.app/Contents/MacOS/applet -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLaplt -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Resources/Scripts/main.scpt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronbieber/org-protocol-handler/5f4927b7c6b07d553b4b792e0f0b54985d63bf8b/Org Protocol Handler.app/Contents/Resources/Scripts/main.scpt -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Resources/applet.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronbieber/org-protocol-handler/5f4927b7c6b07d553b4b792e0f0b54985d63bf8b/Org Protocol Handler.app/Contents/Resources/applet.icns -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Resources/applet.rsrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aaronbieber/org-protocol-handler/5f4927b7c6b07d553b4b792e0f0b54985d63bf8b/Org Protocol Handler.app/Contents/Resources/applet.rsrc -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Resources/description.rtfd/TXT.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600 2 | {\fonttbl} 3 | {\colortbl;\red255\green255\blue255;} 4 | {\*\expandedcolortbl;;} 5 | } -------------------------------------------------------------------------------- /Org Protocol Handler.app/Contents/Resources/parse.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from __future__ import absolute_import, print_function 4 | 5 | import os 6 | import subprocess 7 | import sys 8 | 9 | import six.moves 10 | 11 | 12 | def read_config(): 13 | """Read and parse ~/.orgprotocol.ini if it exists.""" 14 | ini_path = os.path.expanduser("~/.orgprotocol.ini") 15 | config = six.moves.configparser.ConfigParser() 16 | try: 17 | config.read([ini_path]) 18 | except Exception: 19 | print("Error reading %s" % ini_path) 20 | return config 21 | 22 | 23 | def emacs_client_command(config): 24 | """Construct a list, each member of which is a part of the 25 | `emacsclient` command to be run by `subprocess` and used in 26 | main.scpt. Provides the default `emacsclient` executable if 27 | ~/.orgprotocol.ini doesn't exist.""" 28 | path = emacsclient_path(config) 29 | options = emacsclient_options(config) 30 | cmd = path + options 31 | return cmd 32 | 33 | 34 | def emacsclient_path(config): 35 | """Get the configured path to `emacsclient`, or the default.""" 36 | try: 37 | path = config.get("emacsclient", "path") 38 | except Exception: 39 | path = "/usr/local/bin/emacsclient" 40 | return [path] 41 | 42 | 43 | def emacsclient_options(config): 44 | """Unpack options from config file. Options are appeneded to the final 45 | `emacsclient` command. Returns an empty list if no options are specified. 46 | """ 47 | try: 48 | return list(dict(config.items("options")).values()) 49 | except Exception: 50 | return [] 51 | 52 | 53 | def is_old_style_link(url): 54 | """Determine which version of org-protocol link this URL is. 55 | 56 | The 'old style' link looks like: 57 | org-protocol://capture://