La Tinaja

Nap Time

18 Sep 2018

I like taking naps. I don’t like my phone buzzing while I nap. I want to use my phone’s timer to wake me up from my nap. I don’t want to miss phone calls for days because I forgot to turn Do Not Disturb off on my phone.

iOS 12 came out yesterday, and I wanted to give the new Shortcuts system a whirl. I’ve used Workflow in the past, but fell off the wagon when it all felt too fiddly. Workflow always felt like a big pile of (amazing) hacky workarounds; the promise of system-level integration now that it has become Shortcuts has me excited to mess around with it again.

So, today instead of taking a nap, I made a ’Nap Time’ shortcut.


Problem

I want to take a nap for 30 minutes. I want a timer to wake me up after 30 minutes. I want my phone to be on Do Not Disturb during that time. I want Do Not Disturb off once I’m up.


Do Not Disturb

There is a Shortcut action called ‘Set Do Not Disturb’ that allows you to turn on Do Not Disturb until it is turned off manually, until a prescribed time, until you leave the location where the action was invoked, the current event on your calendar ends, a Magic Variable, or the input from the previous shortcut action.

There is no option to set Do Not Disturb for a specified duration. So I will use the ‘Until: Time’ option and give it a time 30 minutes in the future from now.

There’s another action called ‘Date’ that allows you to pass either the current date (and time) or one you specify to the next action. There is another action called ‘Adjust Date’ which takes a date/time input and allows you perform a calculation against it. In this case, I will select the current date in ‘Date’ and add 30 minutes to it using ‘Adjust Date’. I now have a date/time value to pass along to ‘Set Do Not Disturb’ as the time until which I would like Do Not Disturb active.

Do Not Disturb settings screenshot


Timer

Now I need to set a timer.

Frustratingly, Shortcuts does not have any built-in actions for the Clock app. If I hadn’t listened to a few podcasts over the last couple of months of people using Shortcuts in beta, I would have been stumped.

The way to get timer actions into a shortcut is to use Siri Suggestions. So activate Siri and say “Set a timer for 30 minutes.” Let it run or not. Now go back to the Shortcuts app and select Siri Suggestions in the action list and Siri will suggest to you your recent action you took with the Clock app—in this case “Start a timer for 30 minutes.”

This action can go as the last link your chain. You can choose whether you want to be left in the Clock app with the timer running or not when the shortcut terminates.

Timer shortcut screenshot


Configuration

There’s a settings panel for your shortcut if you tap the toggle switch icon in the top right of the screen. There you can give your shortcut a name and icon. You can also record a Siri trigger phrase so that the new shortcut can be invoked by saying “Run ‘Nap Time’” to Siri where ‘Nap Time’ is whatever trigger phrase you’ve chosen.

Shortcut settings screenshot


Additions

I could also have this play a playlist in Music as well, but what I would really want is for the new Environments app of Irv Teibel field recordings from the Numero Group to start up. Unfortunately it doesn’t appear to have the necessary hooks to work with Shortcuts, so I will have to start it up manually if I want to. I can at least launch the app as the last step in my workflow if I want to.


You can download the shortcut if you would like a head start messing with this stuff. It’s fun.