Efficient use of Orientation Lock with iOS

One of the coolest Shortcuts that I came across through r/Shortcuts (R.I.P. Reddit) was a simple Shortcut for quickly switching Portrait Orientation Lock On and Off for the iPhone. The Shortcut simply checks the current orientation of your iPhone (is it portrait/upright or landscape/sideways?) using an action provided by a Shortcuts helper application (an app specific to providing general-purpose actions for creating Shortcuts). Given that orientation, the shortcut turns Portrait Orientation Lock Off (if portrait) or On (if landscape).

Utilizing the Back Tap feature under Accessibility, you can set it up such that tapping the back of your iPhone executes the shortcut on demand–no opening of the Shortcuts app or the Control Center. I have it set to run on the Double Tap, but Triple Tap can also be set.

The basic use-case for this shortcut is for quickly unlocking the phone’s orientation in order to view content in a way that makes more sense given the context. Let’s say someone sends you a link to some video to watch, but it’s best viewed landscape, and you generally keep your orientation locked. Double Tap the back of your iPhone while it’s upright, and the Shortcut unlocks your iPhone’s orientation, allowing for sideways viewing of the landscape video. Double Tap again while your iPhone is sideways, and the orientation is locked backed to portrait mode again.

Separately from this shortcut, I started using two new Personal Automations for automatically toggling the Orientation Lock based on whatever app I have open:

  1. Whenever an app that I specified is opened, the Orientation is unlocked.
  2. Whenever that same app closes, the Orientation is locked again.

It’s a very simple setup that allows for a better viewing experience for specific apps like YouTube, Photos, Calculator, or even Calendar, where I’m likely to use the landscape orientation to view the app’s content in a better way. I currently have these two Personal Automations set for 36 apps in total on my phone.

I combined these two setups (orientation toggling shortcut and the orientation lock/unlock Personal Automations) to create a system that allows me to temporarily override the Personal Automation for unlocking the orientation for moments where it doesn’t make sense.

The sort of scenario that my solution addresses is a situation where I’m looking through emails on my phone and the orientation is unlocked due to my Personal Automation for auto-unlocking the orientation includes Mail.app. The problem in this scenario is that I’m lying down on the couch or am reclined in some manner where my body’s orientation is landscape. Generally, I want my phone’s orientation lock to match my body’s orientation, otherwise I’m looking at emails sideways, and that’s obviously quite awkward. In this situation, I would utilize the orientation shortcut by back-tapping my phone twice thus locking the orientation (putting it back in portrait mode), realigning my phone’s orientation with my sideways orientation.

Now, imagine that I’m also listening to some music while I’m lying down, and I want to switch to a specific song. I switch to Music.app, change the song, and swipe back to Mail to continue going through my emails. In that quick switch back and forth, nothing changed between my body’s orientation and my phone’s orientation, so I would still want the orientation to be locked just as before. For this reason, I added a bit of logic to the orientation shortcut to mark when I last ran the shortcut, taking that execution time, adding a modest 5 minutes, and then saving that datetime to something like Data Jar. Now, whenever the Personal Automation that is meant to unlock the orientation executes, I added some checks to compare this marked execution time (+5 minutes) to the current time. If the current time is before this +5 time, then don’t unlock the orientation. In addition to not unlocking the orientation as it normally would, it further extends that end time to +5 minutes past the current time, perpetually extending the time if I constantly keep switching back and forth between apps, the idea being that my orientation needs probably won’t likely change as long as I’m actively switching between apps on my phone every 5 minutes or less. This grace-period solution isn’t perfect, but it is helpful for me quite often.


Shortcuts: