This post originally appeared at Org Mode Exocortex, my Org mode-focused blog, on April 30, 2020.

:ID: b3c6cee0-567e-4324-9685-f6fd9959d402

Introduction

Inspired by Stéfan’s post explaining how to voice capture TODOs using Google Assistant on Android, I decided to find out how one would go about hooking up Siri dictation on iOS to Org mode.

It turns out that Siri Shortcuts is a pretty amazing tool that can be used for all kinds of automation on your iPhone or iPad.

Furthermore, because Org mode is text files all the way down, you can use Siri Shortcuts to append to any of the said files via Dropbox or iCloud.

I used this idea to implement three different examples, in order of growing complexity:

  1. Send iPhone clipboard contents into a new Org mode entry, also recording an Org mode timestamp.
  2. Send the current web page to Org mode, with the title as the heading and the URL in the body text.
  3. Voice dictate longer text into an Org mode entry, recording the location (street address) and time.

These are just three simple examples which I needed for my workflow, but the general principle of piping Siri Shortcuts into arbitrary Org files enables a world of possibilities!

Send iPhone clipboard contents in Org mode

I use this shortcut when I want to save something I find on the Twitter app for example. From the app, I can share the relevant tweet, and then select “copy link”.

At this point, I activate the shortcut by swiping down, to the right and then tapping its name in the shortcuts widget.

The shortcut machinery starts, and after a second or two I end up with the following entry at the end of the pre-configured org file, right on my desktop, courtesy of Dropbox:

1
2
3
** Clipboard at [2020-04-30 Thu 20:28]

https://twitter.com/magnushammar/status/1255914288570605568?s=21

To configure this, create a new shortcut, and hook it up like this:

Figure 1: Siri Shortcut to send clipboard contents to Org mode

Figure 1: Siri Shortcut to send clipboard contents to Org mode

The actions you see are:

  1. Format Date, with the current date selected as input, and a custom format with the string “yyyy-MM-dd EEE HH:mm”, to give me the org-friendly timestamp.
  2. Text, which I use to format the org mode entry. When you edit the text, you can select “magic variables”, and that’s where I found “Clipboard”.
  3. Append to File, which is the action you can use to append to files on Dropbox and iCloud, and perhaps also your sync service of choice.

Send the current web page title and URL to Org mode

This is useful when browsing on the phone, and you want to store a link for later processing on the desktop.

Whilst browsing said page, I tap the share icon, and then select “Send URL to Org mode” (the name I assigned to the shortcut), and a second or two later, the following entry appears in the org file I preconfigured as my mobile inbox:

1
2
3
4
** Voice capture org-mode tasks on Android – Org mode Exocortex
[2020-04-30 Thu 23:24:48]

- URL: https://orgmode-exocortex.com/2020/04/28/voice-capture-org-mode-tasks-on-android/

The shortcut looks as follows:

Figure 2: Siri Shortcut to send current web page url and title to Org mode

Figure 2: Siri Shortcut to send current web page url and title to Org mode

This one is only slightly more complicated, because it’s intended specifically for the Safari share sheet.

When you create the shortcut, tap the three dots to the right of shortcut name to get to the Details window. Once there, check “Show in Share Sheet”. Under “Share Sheet Types” ensure that only “Safari web pages” is checked.

The bottom three actions are the same as above.

At the start we have two instances of the “Get Details of Safari Web Page” action, one to get the title, and the other to get the URL.

Dictate time- and location-stamped notes to Org mode

This is the most fun shortcut of the three.

You get to talk to your phone, and then watch as the transcription of your speech appears magically in the org file that you have open in Emacs on the desktop!

Here’s an example:

1
2
3
4
5
6
7
8
** Voice note at 73 Farnam Street on [2020-04-30 Thu 11:25]

Dear readers,

I am writing this email to you to demonstrate Siri shortcuts and Siri dictation :-)

Kind regards,
Charl

(As an aside, this handy Siri dictation guide has a bunch of tips for making paragraphs, punctuation and the all-important “smiley face”.)

The shortcut you create should look like this:

Figure 3: Shortcut to dictate time- and location-stamped note to Org mode

Figure 3: Shortcut to dictate time- and location-stamped note to Org mode

The final “Append to Document” action is not shown, but it is identical to the two short examples above.

Note that I’m using the “Get Current Weather” and “Get Details of Weather Conditions” actions to get my current location, as this is much faster than the perhaps more accurate “Location” action which seems to wait for a GPS lock. See this thread on reddit for more details.

The “Get Details of Locations” gives me my current street name, which is more than enough to remind me where I was when dictating the note in question.

Conclusion

Being able to send discoveries from the phone to Org mode is an important part of my knowledge management workflow.

I have been using Signal’s super flexible “Note to Self” function for this, but the Siri Shortcuts approach gets the snippets right into Org mode more quickly.

The note dictation into Org mode path is new to me.

I was surprised by how well Siri managed my accent. I’m curious to see how much this comes in useful during the coming weeks. Whatever the case may be, it does make for a fun demo.