Home

You’re Doing That Wrong is a journal of various successes and failures by Dan Sturm.

"Open on Which Mac" Shortcut

A few weeks ago, I started a new job. Along with that job came a new iMac and Touch Bar MacBook Pro. Having doubled the number of computers in my life, I quickly found that my frequently-used Open on Mac iOS Shortcut was not working as expected.

While at work, attempting to open a webpage on my iMac would result in...nothing. When I got home, I found the pages open and waiting for me on my personal iMac.

Prior to the newly acquired computers, I had never given much thought to why webpages opened on my iMac rather than my MacBook Pro. I spent 98% of my time on the iMac and, since it was doing what I wanted it to do, there was no reason to ask why. I mostly assumed it was because the MacBook Pro was asleep and the iMac is always awake.

As it turns out, the real reason webpages always opened on my personal iMac is because it has the fastest internet connection (a wired fiber connection) and would therefore download the Dropbox file containing the URL before any other computers had the chance. Hazel would then do its thing, trash the file, and that was that.

It had become necessary to modify my iOS Shortcut, allowing me to specify on which computer I wanted to open the webpage. To accomplish that goal, I added a "Choose from List" action to the shortcut where I could pick which computer to use. Then, I added short prefixes to the filename that represented each computer.

 
 

The original text file containing the page URL was called "URL-Current Date.txt". The new file names are:

  • The Touch Bar: tbr-URL-Current Date.txt
  • The New iMac: niM-URL-Current Date.txt
  • My MacBook Pro: mbp-URL-Current Date.txt
  • My iMac: diM-URL-Current Date.txt

Add a couple of "If" statements to the shortcut and we're about done. Here's what the new, much longer shortcut looks like.

 

These If statements are terrible and ugly and there’s got to be a better way to do this, but I don't know what it is.

 

After finishing the shortcut, all that was left to do was add the prefixes to the name search field in the Hazel rules running on each computer and call it done.

P.S. Thank you, again, to Jason Snell for fixing my very unsafe, poorly conceived version 1.0.

"Overcast to Castro" Shortcut

I love podcasts. And I love when my friends on the internet share the podcasts they love.

One of the most common ways people share their podcast recommendations is with a link from their podcast player app, which, more often than not, is Overcast. I, however, am primarily a Castro user.

I can't count how many times I've opened an Overcast link on social media, switched over to Castro, searched for that podcast by name in the Castro "Discover" tab, then added the recommended episode to my Queue for listening later. An incredibly inefficient and annoying workflow.

Oh, how I wish I could just press a button and have that Overcast link open in Castro, showing me the episode ready to be queued.

Both Overcast and Castro support public URLs for sharing shows and individual episodes. This is in addition to the apps' specific iOS URL schemes.

I have no idea how either of these apps are generating their episode-specific URLs, but the URLs for the main feed of a podcast use the podcast's iTunes ID. The Overcast and Castro links for the Defocused main feed are https://overcast.fm/itunes891398524 and https://castro.fm/itunes/891398524, respectively.

Which means I can create a quick Shortcut to swap an Overcast link for a Castro link.

 
 

Half of a Solution

Since this shortcut only works on a podcast's main feed URL, not an episode specific URL, I still have to do some work to get the podcast episode into my Castro Queue. I have to open the Overcast link, tap on the name of the podcast at the top of the player to go to its main feed, run the shortcut, tap the "Open in Castro" button, tap the button that allows Safari to actually open Castro, then find and add the specific episode to my Queue.

Look how pretty these screenshots are. They were made with Stu Maschwitz’s “Big Tennis Screenshots” Shortcut, which you can download here.

Not ideal, but much more pleasant than manually searching for the name of the show. Especially if episode being shared by the Overcast user happens to be the most recent episode of the show since Castro loads with the Action buttons for that episode ready to tap.

Maybe one of these days I or, more likely, one of you much smarter people, will figure out how to translate episode specific URLs that open directly within Castro (or Overcast), avoiding all these Safari links as a bridge. Heck, while I'm wishing for unlikely things, maybe Castro will finally get timestamped URLs, too. One can dream, right?

Open Website on Mac Workflow

Update – 2018-01-05

Over at Six Colors, Jason Snell has created a much smarter, safer version of this whole iOS to Mac automation idea.

His version, smartly, builds the shell script on the Mac side — only receiving keywords and URLs from the iOS device — as opposed to my version which is set up to just immediately run whatever text file shell script happens to pop up in my Dropbox folder. A less-than-ideal setup should someone else acquire access to that Dropbox folder. Go check it out.


This may be one of the laziest automation tools I've ever created, but I solves an annoyance that's been bugging me for a long while now.

Often times I'll be looking at a website on my iPhone and I'll want to switch over to viewing it on my Mac. "That's why Apple created Handoff," you say. Yes, well, personally I find Handoff to be slow, unreliable, and only half of the solution.

I'm looking at a website on my phone. I want to press a button on my phone and have that website open in Safari on my Mac. I don't want to wait for a dock icon to appear on my Mac. I don't want to try to click on it, quickly, before it disappears. I don't want to look through a list of open iCloud tabs in Safari on my Mac.

I want to tap and have it open.

What I Did

I used everyone's favorite iOS automation tool Workflow.app to create an Application Extension Workflow that grabs the current URL and saves it to a date/time stamped text file in a specific Dropbox folder. It looks like this:

 
 

Then, I set up Hazel on my Mac to monitor that folder and, when it sees a new file, run the file with Bash, then throw it in the Trash. Here's what that looks like:

Overly complicated? Probably.

Lazy? Almost certainly.

Does it do the job I wanted it to do? Absolutely.

It takes about 6 seconds from tapping on the Workflow in Safari on my phone to having an open page in Safari on my Mac. That's not exactly fast, but it's no slower than using Handoff. It's also far more reliable and requires less interaction from me.

And, let's not forget, this will work from any distance. There's no Bluetooth range limit like Handoff. Wherever you are, as long as you've got an internet connection, you can use this Workflow to have a website open and waiting for you on your Mac when you get home.

iOS Spinner Gizmo for Nuke

Throughout the course of my work, I end up rebuilding and animating a lot of app interfaces. One of the most common pieces of the iOS interfaces I create is the "thinking" spinner.

It's one of those things that I almost always need, and typically forget about until I need one. Which usually results in me grabbing a screenshot of a spinner from the app and animating it to rotate. Which is not actually what it does [1].

Since I like to use my free time between projects to automate repetitive tasks, I built a Nuke Gizmo to take care of this in the future.

Default Spinner

Default Spinner

Dark Mode Spinner

Dark Mode Spinner

In order to make it useful in almost any situation, I made the spinner gigantic. It's built on a 1024x1024 Constant. It's got alpha and it's premultiplied, ready to go. It makes a full revolution in exactly 1 second [2].

Spinner Node Graph

The exposed controls are exceedingly basic. It has Transform, Scale, and Dark Mode controls. The default spinner is white on a semi-transparent black round-rect. Dark Mode switches it to a black spinner with no round-rect backdrop; typically used on mostly-white interface images.

I'm going to get a ton of use out of this little thing and, if you think you will too, hit the download link below. Drop the gizmo file into your .nuke directory and add the following to the bottom of your Menu.py file:

toolbar = nuke.menu("Nodes")
gzmos = toolbar.addMenu("Gizmos")
gzmos.addCommand("iOS Spinner", "nuke.createNode('iOS-spinner')")

Download: iOS-spinner.gizmo


  1. I animate them with an expression, not keyframes. I’m not an animal.  ↩

  2. Not the absurdly slow speed your browser is displaying the GIFs.  ↩