red when excited

Dash and Oyster: Sandboxed AND Integrated

Thursday, June 20, 2013

We were nearing completion of Oyster (, code generation was in, and whilst fixing a bug I used a snippet we have in Dash (, and it suddenly struck me that it would be great if we could create snippets in Dash directly from Oyster. 

We fired off an e-mail to Kapeli to test the waters… would he be interested? The immediate and welcome answer was yes, but with the follow up question… as a pair of sandboxed app store applications, how could we make this work? 

His reply contained a couple of initial thoughts

  1. Use the Dash service “Create Snippet in Dash”... possible, but not a great user experience (make sure you have services turned on just for starters, but also the user would have to name it, set the language… things Oyster already knew)
  2. Distributed notifications… but that would only work if we weren’t sandboxed
  3. Try and write to Dash’s library directly. Ugly, and fragile, we’d be immediately loose the ability to change our core formats easily and the user would have to navigate to the Dash library to even give permission
  4. Custom URI that only Dash would open, allowing the snippet to be stored. This felt like a good choice, but what if the regular expression were very long? Would we hit encoding issues? 
We iterated around solution 4, as it felt the closest to what we want (and it’s basically how iOS apps try and deal with similar restrictions). Ultimately we augmented it somewhat… here’s the flow

  1. The user invokes the “Save to Dash” action in Oyster
  2. Oyster would “open” a URI that essentially tells Dash that there is some special data on the clipboard. The pasteboard type was custom to ensure we don’t tread on other clipboard content. That special data contained the snippet, it’s name, language, and a unique ID that would ensure if the user modified the regular expression, we would just update Dash, not create a new snippet
  3. Dash is started/activated by the URI, grabs the data from the pasteboard, and creates or updates the snippet 
Simple, robust, elegant, and Sandbox friendly. We did the work on either side and just 8.5 hours after I sent the initial e-mail we had builds that worked together. 

I thought it was worth sharing, as you don’t see a lot of inter-apperability on the Mac App Store. I’d also like to take this oppertunity to personally thank and praise Kapeli. Open and accommodating, innovative and fiercly productive. Thank you. 
Please wait...