Using a Mac from iOS, Part 2 – Luna Display and macOS as an App

iPad Diaries is a regular series about using the iPad as a primary computer. You can find more installments here and subscribe to the dedicated RSS feed.

In the first part of my ongoing experiment with controlling and accessing a Mac from the iPad Pro, I covered FileExplorer – the app I use to open Finder locations from iOS’ Files app – and shared a collection of shortcuts to control certain macOS features via Siri and the Shortcuts app. I also described my podcasting setup and how I’ve been taking advantage of Keyboard Maestro to automate window resizing across my two displays connected to the Mac mini. Today, I’m going to cover one of those two external displays – the iPad Pro running the Luna Display app – and how I’ve been using it to have “macOS as an app” on my iPad Pro. If you find this idea of reducing macOS to an app that runs on the iPad upsetting, the rest of this article likely isn’t going to make you happy. If you’re intrigued, however, strap in because I have a lot to share.

Allow me to offer some context first. In case it wasn’t clear with the first installment of this mini-series, the iPad Pro is still my primary computer and I still use it every day for the majority of my work. The main work-related task that I need to perform on macOS is podcast recording1. My Mac mini is primarily a home server dedicated to tasks that are not supported on iOS such as running Plex Media Server, adding HomeKit compatibility to unsupported accessories via homebridge, and downloading 4K versions of YouTube videos using shell scripts. The fact that I acquired a Mac mini and have been using it more than my old MacBook Pro does not mean I’m abandoning the iPad Pro and “going back to the Mac”.

In fact, it’s quite the opposite. As I noted in the last installment of iPad Diaries, I like using macOS for certain tasks that are not available on iOS, but I don’t like being forced to sit down at my desk to use a different computer. After working on the iPad as my main computer for the past seven years, I guess I take its extreme portability for granted. With the iPad Pro I can work from my desk and the kitchen table and the sofa and the balcony; with the Mac mini, I have to sit in a corner of my bedroom.

And it’s not like I only use my Mac for recording podcasts. For all the effort I’ve put into trying to optimize my iPad setup and get everything done on iOS without macOS, there are still certain tasks that I can only perform on a Mac. For example, downloading multiple files with Safari’s download manager on the Mac and having them saved in the Finder is easier than using iCab on iOS if I later need to move those files to an SD card (or, God forbid, a USB drive). Checking the status of my homebridge server (which I leave running in a Terminal window) or tweaking automation settings in Hazel are other examples of app-related tasks that can’t be done on iOS because those apps are Mac-only. I could go on: iTunes is the only way to connect to AirPlay 2 speakers and control them with automation thanks to AppleScript (Shortcuts for iOS does not support these kinds of actions); some websites still don’t work well enough (or at all) in Safari for iPad, such as Google Docs, which I have to use every day to prepare show notes for my podcasts; speaking of Google Docs, I have found that pasting rich text from Evernote into a Google document is only supported on the Mac; for some reason, the rich text framework on iOS loses formatting when copying and pasting between Evernote and Google Docs.

These are just some examples of tasks that I need to perform for my job and apps I need to use for personal reasons that, despite my unending iOS optimism, cannot be completed in a reasonably efficient way on the iPad alone. Which means that, while I consider the iPad Pro my primary computer, I also have a use for the Mac these days, and I don’t begrudge this at all. I like using macOS for what it’s good at, and I’m having fun re-learning my way around apps like Hazel and Keyboard Maestro.

I like using macOS for what it’s good at.

However, this doesn’t change the fact that I’m still not in love with the idea of the Mac mini requiring me to sit down in one specific location of the house to use it. What if I’m in the middle of a writing session on the iPad Pro in another room but need to quickly check something on the Mac? On the other hand, when I am using the Mac mini, what if I could “expand” the setup at my (relatively small) desk by adding another display without actually buying a new, separate external display for the Mac alone? This is where Luna Display comes in.

Disclaimer

This is where I should put the disclaimer that Luna Display has sponsored this website and my podcasts in the past; however, this article is entirely based on my personal opinion of things I like and dislike about my Luna Display unit, which I bought and paid for myself months ago.

Get More iOS Productivity Tips and Shortcuts

With a Club MacStories subscription, you’ll gain access to weekly iOS shortcuts, app recommendations, and other exclusive extras.

Starting at $5/month, Club MacStories includes MacStories Weekly – a newsletter delivered every Friday with a focus on iOS productivity and showcasing new and interesting iOS apps. One of MacStories Weekly’s regular sections is the Workflow Corner – a weekly assortment of iPad shortcuts, iOS automation tips, and tutorials curated by Federico and the MacStories team.

As a new member, you’ll also receive complete access to our back catalogue of over 200 newsletters starting from September 2015.

You can find out more about Club MacStories here, or subscribe directly below.

Luna Display

By now you’re probably familiar with Luna Display: it’s a popular third-party accessory that resembles a tiny USB key and which you plug into your Mac. The Luna device pretends to be a physical display attached to the Mac (hence why the device comes in two versions, Mini DisplayPort and USB-C – standards typically used for connecting displays) while, in practice, it connects wirelessly to a Luna Display app running on your iPad, which is where you’ll actually see the macOS interface.

The Luna Display is tiny.

The chief advantage of Luna Display over other apps that promise to turn your iPad into a wireless display for your Mac is the fact that Luna Display is a hardware-based solution that can tap directly into the power of your Mac’s GPU to optimize performance. Luna is based on the LIQUID engine, which its developers previously used for their AstroPad creative app and later realized could be applied to a more generalized second-display product such as Luna Display. The benefits of a physical device plugged into your Mac combined with the LIQUID engine can be summarized as follows: Luna Display supports hardware acceleration with Retina quality and up to 60fps; its Velocity Control feature analyzes network traffic dozens of times each second to dynamically optimize image quality depending on your WiFi network; and, LIQUID supports the full range of native iPad features such as Pencil-based UI control and keyboard shortcuts.

Comparing Luna Display to other software-based solutions (such as Duet and Air Display) is beyond the scope of this article, but I’ll say this: I tested both alternatives with my 2018 Mac mini and 2018 iPad Pro running on a 5Ghz WiFi network powered by an Orbi mesh system, and none of them came even close to the performance and responsiveness granted by Luna Display (I have a USB-C version). With those apps, I constantly ran into choppy animations, typing latency, or poor image quality.

This is not to say that Luna Display is flawless2 or that it perfectly mimics the experience of connecting a monitor to a Mac via a cable: I still see the occasional slowdown and image artifact when using Luna Display, particularly when lots of things are going on in my network (such as Backblaze or Dropbox) or when I’m working with several windows at once. Those issues, however, are always temporary and resolved in a couple of seconds by the LIQUID engine; the overall performance of Luna Display is excellent, to the point where I sometimes forget there is no cable running from my iPad Pro into the Mac mini. I can work with macOS from my iPad Pro at the kitchen table, and it feels like the Mac mini is right next to me, not in another room with a wall between us. All of this to say: the Luna Display performance hype is most definitely real, and it’s vastly superior to any other software-based solution I’ve tested before.

With Luna Display, I can AirDrop files to the same iPad running a different OS.

I should also point out a few details about Luna Display as an iPad app that integrates with iOS. Luna Display turns your iPad into a wireless display for the Mac; as such, it lets you touch the screen to control Mac interface elements, or you can use the Pencil if you need more precise control. If you’re using the iPad running Luna Display as a secondary monitor for the Mac, you can use the Magic Trackpad you normally use as the Mac’s primary pointing device and control what’s on the Luna Display. Again, the Luna Display is just an additional monitor for your Mac that you can find under System Preferences ⇾ Displays. If you don’t want to use peripherals paired with your Mac to control what’s on screen in the Luna Display app on the iPad, besides the aforementioned support for touch controls and the Pencil, you can use whatever keyboard is paired with the iPad; keystrokes and keyboard shortcuts are natively sent to macOS, which means an iPad Pro with a Smart Keyboard and Apple Pencil is a perfectly fine combination to have both keyboard input and cursor control in one integrated package that runs on iOS.

For obvious reasons, Luna Display does not support Split View (it needs to show you the Mac’s display in full-screen); even though I sometimes wish that was an option (imagine being able to keep both macOS and an iOS app right next to each other!)3, I can just put other iOS apps in Slide Over on top of Luna Display, and that works well enough.

The good thing is, once Marzipan ships, this hybrid environment will be macOS’ new reality and fewer people will probably call me crazy. At least one can hope.

At a high level, there are two ways to turn the iPad into a monitor for the Mac using Luna Display: you can either use Luna Display as a second monitor in addition to the primary display of the Mac, which is what you’d do if your Mac was a MacBook Pro, iMac, or any other Mac with a display always attached to it; or, you can use Luna Display as the primary display if you have a “headless” setup (such as a Mac mini) or if you manually change the display arrangement in macOS’ System Preferences. In the few months I’ve spent using the Luna Display with my iPad Pro, I’ve noticed pros and cons in each approach, and I’ve come up with a series of workarounds, best practices, and tips I want to share today.

Waking the Mac with a Siri Shortcut

First of all, if you’re like me and have a Mac desktop you want to control with the Luna Display on an iPad around the house, chances are you’ve set macOS to put the computer to sleep after a few minutes of inactivity. And while the Luna Display receiver app for Mac can keep running in the background all the time, it won’t be able to wake your computer from sleep if an iPad running the Luna Display app for iOS tries to connect to it. Your computer needs to be awake and running the Luna Display app if you want to control it from the iPad.

As I shared in the last installment of iPad Diaries, I put together two custom shortcuts to obviate this very problem. The shortcuts take advantage of the Shortcuts app’s native ‘Run SSH Script’ action to send a caffeinate command to the Mac’s shell; this command, as I explained in the article, wakes a computer from sleep and displays the login screen.

Easy enough.

If you’re close enough to the Mac for Apple Watch proximity-based authentication to work, you won’t have to do anything else for the Mac to be unlocked. In fact, most days I can just say “Hey Siri, wake Mac” to my HomePod (or AirPods) before opening Luna Display on the iPad, and my shortcut will wake the Mac mini, which will be instantly unlocked by my Apple Watch. And at that point, the Luna Display app that I always keep running in the macOS dock will be ready to connect to its iOS counterpart. For those rare times when I’m not wearing an Apple Watch though (or if I already know the Apple Watch authentication is going to fail because I’m too distant from the Mac mini), I use a different flavor of the same shortcut that types my password too after waking the Mac from sleep.

Make sure that you enable Remote Login (SSH) for these shortcuts to work.

Thanks to these two shortcuts, I can let my Mac mini go to sleep as usual but still quickly connect via Luna Display when I need it. You can download the shortcuts below, or find them in the MacStories Shortcuts Archive.

Wake Mac

Wake the display connected to a Mac on the same local network as your iOS device.

Get the shortcut here.

Wake Mac + Login

Wake the display connected to a Mac on the same local network as your iOS device and paste your password in the login screen by simulating keystrokes.

Get the shortcut here.

Luna Display as a Primary Display

While Luna Display is primarily advertised as a way to extend your Mac setup by adding a secondary display that is actually an iPad, over the past few months we’ve seen a few examples of folks turning the iPad Pro running Luna Display into a primary display for a headless Mac setup. Of course, some of them were probably inspired by the fact that the Luna Display creators themselves touted the advantages of such an approach when the new Mac mini launched in November.

It is possible to use Luna Display as your Mac’s primary monitor, and I’ve done it myself several times over the last couple of months, but it’s not the solution I recommend unless you really have a Mac mini without a display physically connected to it.

It’s important to note the distinction macOS makes when dealing with external displays in what Apple labels “extended desktop mode”. By default, a Mac has a primary display and optional secondary displays; the primary display is where your desktop icons and app windows first appear. You can move windows between displays, and you can tweak the arrangement of displays in System Preferences, but you’re always going to have to keep in mind that macOS can only see one display as primary and that choosing a different primary display has to be done manually by the user.

Here’s the problem: unless you set the Luna Display monitor to be the primary one beforehand, or unless you come up with ways to mitigate this issue (more on this in the next section), every time you open an app or trigger a keyboard shortcut on the iPad running Luna Display the associated action will be performed on the primary display by default. In my case, that meant that hitting ⌥Space to trigger Alfred would show the app’s search window on the UltraFine 4K, which is my Mac mini’s primary display, rather than the Luna Display on the iPad Pro; similarly, I couldn’t see the dock and desktop icons on the iPad, and every app window would open on the UltraFine by default. As someone who has a traditional desktop setup with a Mac connected to a display and just wants to use Luna Display as an optional way to control it (as I bet most users do), this is not an ideal situation.

The solution, as I noted above, would be to use the Luna Display as the primary monitor for the Mac. The problem is that there’s no intuitive or automatic way to quickly switch primary/secondary displays on Mojave that doesn’t involve disabling SIP (at least to my knowledge)4, and I’d rather keep that extra security feature enabled permanently. Which leaves us with the two manual options: physically unplugging the primary display from the Mac so that Luna Display can become the primary one by default (but this only works for Macs where the display can be disconnected, like a Mac mini); or, we have to manually select the primary display in macOS’ System Preferences.

If you own a Mac mini and are okay with the first option for those times when you want to use Luna Display for a long work session, then great – just unplug the primary display and use Luna Display instead. I tried this a few times and, personally, I couldn’t stand the slight annoyance of having to re-plug the USB-C cable into the back of the UltraFine every time I had to sit down in front of my Mac mini. Workarounds that involve physical actions to be performed and remembered are not for me.

The other approach, which I begrudgingly use on occasion, requires you to select a different primary display by going to System Preferences ⇾ Displays ⇾ Arrangement (while Luna Display is connected) and relocating the white menu bar to the new primary display by dragging it on top of the Luna Display monitor.

Good luck doing this without an Apple Pencil.

Here’s my issue with this: the menu bar that acts as an indicator of the primary display is a thin stripe of pixels that I can’t manage to select using my finger alone when using Luna Display on the iPad. This interface element was clearly designed for a desktop pointing device; the only way I found to move the menu bar from the iPad is to use the Apple Pencil. Again, possible, but not ideal, and definitely not automated in any way. Even with this approach, however, you’d still run into the problem of System Preferences initially opening on the primary display.

I tried everything I could imagine to make Luna Display work as a primary display for my setup; ultimately, I realized that as long as I keep the UltraFine on my desk, that’s going to be treated as the primary display by the Mac mini; there are workarounds, but I’m not in love with any of them.

So I started looking at the problem from a different perspective. If Luna Display was conceived as a way to turn the iPad into a secondary display for the Mac, what could I do to overcome the limitations of secondary displays instead of trying to shoehorn Luna Display into being a primary display on-demand? As it turns out, there’s a lot of flexibility involved with optimizing the software experience for secondary displays, and that’s when Luna Display finally clicked for me.

Luna Display as a Secondary Display: Keyboard Shortcuts

As a first order of business, I realized I needed to change some of the keyboard shortcuts that were in conflict between macOS and iOS.

Despite the fact that it creates the illusion that you’re using macOS on an iPad, it’s important to remember that Luna Display is still an iPad app, and as such it responds to default keyboard shortcuts that are shared system-wide across all apps on iOS. Specifically, when I started using Luna Display, the keyboard shortcuts to activate Spotlight search and the app switcher (⌘Space and ⌘Tab, respectively) kept triggering those functionalities on the iPad rather than being passed over to macOS. I had to replace them if I wanted to use the Mac’s search feature and app switcher from Luna Display on the iPad.

Disabling Spotlight was easy. To do this, go to System Preferences ⇾ Spotlight ⇾ Keyboard Shortcuts and disable ‘Show Spotlight Search’. If you want to keep using Spotlight but simply change its keyboard shortcut, click on it and record a new one from the keyboard. I’ve always preferred Alfred to Spotlight, so I turned off Spotlight’s keyboard shortcuts completely and started using ⌥Space to trigger Alfred’s search window, which does not conflict with iOS’ ⌘Space shortcut. It took a while to get used to opening search on the Mac with this new hotkey after years of ⌘Space, but the trade-off has been worth it. I can now use both iOS search and Alfred from Luna Display on the iPad – which is nice when I want to put an iOS app on top of Luna Display in Slide Over mode.

Replacing the ⌘Tab app switcher was trickier. As far as I know, there is no way to remap the default keyboard shortcut for the app switcher on macOS that doesn’t involve installing system modifications I’m not comfortable with. So I went in a different direction and settled on a third-party app switcher that mimics the default Apple one but extends it with some additional options, including customizations for its appearance and keyboard shortcut. The app is called Command-Tab Plus, and it looks like this after my customizations:

A custom app switcher that does not interfere with iOS’ built-in one.

In terms of preferences, as you can see below, there are plenty of options you can configure to filter which apps are going to be shown in the custom switcher and what the palette looks like. I appreciate how I can hit numbers to quickly select specific apps and how I can cycle backwards in the list of apps by holding down the ⇧ key, just like with the Apple switcher.

Effectively, at this point I have two separate app switchers on my Mac mini – the default one and Command-Tab Plus. This way, when I access the Mac from Luna Display on the iPad I’m free to use either the iOS app switcher5 or the Mac one. Once again, it took me a few days to get accustomed to using ⌥Tab after years of muscle memory with a different keyboard shortcut, but I prefer the extra versatility granted by Command-Tab Plus now.

Controlling Windows with BetterTouchTool

To the best of my knowledge, by default macOS does not provide any keyboard shortcuts to cycle an app window through multiple displays, which, as I’ve noted in this article, is the most annoying limitation of using Luna Display as a secondary display for your Mac. To fix this problem, I’ve turned to BetterTouchTool.

It’s nearly impossible to sum up what BetterTouchTool can do in a single paragraph, but I’ll try: with BetterTouchTool, you can associate almost any action on your Mac with a custom keyboard shortcut, gesture, mouse click, or Touch Bar button. Whether you need to launch apps, trigger a specific menu item of an app, control windows, or run AppleScripts, BetterTouchTool can do it. It’s like Keyboard Maestro, but with a simplified interface that’s designed to let you quickly program your own shortcuts. If you’re interested in this kind of utility, take your time to read through the documentation and play around with a few examples; invest enough time into learning BetterTouchTool and what it can accomplish, and you’ll end up with a highly personalized macOS environment that can save you several minutes every day.

In my case, all I had to do to make it easier to fling app windows across displays was use BetterTouchTool’s ‘Move Window to Next Monitor’ action. As shown below, all it takes is creating a new shortcut in the ‘Keyboard’ category of the app, giving it a hotkey, and picking the action from a list of predefined steps:

Now, whenever I want to move a window that has opened on the primary display (the UltraFine) to the Luna Display, I just need to press ⌃⌘L and the window will instantly move. But that’s not all: if I’m working with two displays at once (for instance, when I’m recording podcasts), I can hit the same shortcut to shuffle the current window back to the primary display because BetterTouchTool’s action is designed to move windows to the “next” monitor, so it’s not specific to the Luna Display one.

There are other BetterTouchTool actions I set up to improve the experience of using macOS from the iPad Pro. I was finding it difficult to maximize the size of app windows due to the small size of window resizing controls (because macOS is not optimized for touch interactions), so I assigned the ‘Doubleclick Window Titlebar’ trigger to ‘Maximize Window’.

Thanks to this gesture shortcut, when I’m using Luna Display and want to resize windows to fill the iPad Pro’s screen, all I need to do is double-tap their title bar and they’ll expand to all four corners of the display.

I also created a BetterTouchTool shortcut to resize windows so they can fill the screen until they reach the edge of the dock on the right side of the screen and the custom Accessibility panel at the bottom. To do this, I assigned a hotkey to ‘Custom Move/Resize Window’ and configured the action’s parameters as follows:

Essentially, this configuration tells BetterTouchTool to start resizing a window from the top-left corner of the display and fill the remaining space on the right by taking into consideration both the dock and menu bar. In terms of height, I set BetterTouchTool to give it an absolute value of 880px, which I manually calculated (with trial and error) to account for the presence of the Accessibility panel. Here’s an annotated version of the configuration screen that highlights the options I just mentioned:

I’ve barely scratched the surface of what BetterTouchTool can do, but I believe its support for multiple displays and window control actions is perfectly suited for Luna Display users who want a better way to deal with windows across multiple displays.

Custom Accessibility Keyboard Panel

Lastly, I want to explain how I’ve been taking advantage of macOS’ built-in Accessibility Keyboard feature and how I’ve turned it into a custom shortcut panel to trigger various features of macOS more comfortably both from the iPad Pro and when I’m working on my Mac mini.

Among the several Accessibility features supported by macOS, Apple offers a customizable Accessibility Keyboard that lets you use a Mac without a physical keyboard. For users with physical impairments, this is an essential functionality that allows them to type and use apps without having to interact with a physical keyboard. By default, the Accessibility Keyboard looks like a standard QWERTY onscreen keyboard; however, you can fully customize its appearance, as well as create new virtual keyboards from scratch, by using the built-in Panel Editor app available for free on macOS.

The Accessibility Keyboard is based on the idea of panels, and users can create multiple panels with buttons that perform specific actions such as launching apps, triggering system functions, or running AppleScripts. You can create as many panels as you want, and you have complete control over the appearance of buttons and their layout. In addition to the Apple documentation I linked above, I recommend checking out this article from AbilityNet about Panel Editor.

The Accessibility Keyboard and its custom panels are typically employed by visually or physically impaired users who want to have a more comfortable way of interacting with certain macOS features, which is a beautiful idea that confirms how Apple is at the forefront of Accessibility among all tech companies. But I had a different idea: what if I could use custom panels to create a “keyboard” that was actually a shortcut launcher for various apps and AppleScripts that I frequently invoke on my Mac?

I came up with this approach because I realized that, when using macOS via Luna Display on the iPad Pro, I wanted to have something that would allow me to visually launch specific commands in the fastest way possible. I’ve always been terrible at remembering long lists of keyboard shortcuts; instead, I wondered if I could have a “command palette”, sort of like Launch Center Pro but for the Mac, which would let me quickly execute actions with a single tap. Not only did I come up with a system that works well on the iPad because buttons are large enough to be tapped, but in the past few months I’ve also gotten used to this tool when I’m working at the Mac mini.

The final result looks like this:

And here is what it looks like when it’s being configured in Panel Editor:

The Panel Editor.

As you can see, each button (I used emoji to make it more visually pleasant) is associated with an action that I frequently perform on the Mac. To modify the appearance of a button and the action linked to it, there is an inspector on the right side of Panel Editor. Here, in addition to font size and color, you can choose the type of action a button should perform from a list of:

Go Back

Open Panel

Show / Hide Toolbar

Dwell

AppleScript

Enter Text

Press Keys

Open App

System Event

Typing Suggestions

Built-in actions that can be assigned to buttons from Panel Editor.

As I mentioned above, most of my buttons are based on the AppleScript action and scripts I’ve saved in the /Scripts folder of the Mac’s Finder. Of course, when a button triggers an AppleScript, the script runs in the background, so you never see any AppleScript code onscreen.

The ‘Toggle iTunes’ button, as the name suggests, toggles the playback state of iTunes. This is nice because, as I noted previously, iTunes is the only music app made by Apple that supports AirPlay automation for multiple HomePods. The button is based on the following script:

tell application "iTunes"
if player state is paused then
play
else if player state is playing then
pause
else
play
end if
end tell

The ‘Mute’ button is another shortcut to quickly mute/unmute system audio on the Mac mini, and it is a built-in action of Panel Editor:

The ‘Downloads’ and ‘iCloud Drive’ buttons open those folders in a new Finder window with one tap6, so I don’t have to navigate the file system to get there:

tell application "Finder" to open "Macintosh HD:Users:viticci:Downloads"

set userLibraryFolder to path to library folder from user domain
tell application "Finder"
reopen
activate
set iCloudDriveFolder to folder "iCloud Drive" of folder "Mobile Documents" of userLibraryFolder
set target of Finder window 1 to iCloudDriveFolder
end tell

The ‘Slack’ button is based on the ‘Open App’ action and it, well, launches the Slack app.

With ‘Homebridge’, I came up with a simple way to restart my homebridge server whenever my Mac mini reboots or if I just want to start up the HomeKit server again. It’s also based on an AppleScript:

tell application "Terminal"
activate
delay 2
set shell to do script "homebridge"
end tell

The ‘Hide Luna’ and ‘Dock’ buttons toggle the visibility of the Luna Display popup (seriously, it’s always in the way), and the macOS dock.

tell application "System Events"
if visible of process "Luna Display" is false then
tell application "Luna Display" to activate
else if visible of process "Luna Display" is true then
tell application "Finder" to set visible of process "Luna Display" to false
end if
end tell

tell application "System Events"
tell dock preferences to set autohide to not autohide
end tell

And finally, the ‘MacStories’ button launches the MacStories website in a new Safari tab.

tell application "Safari"
tell window 1
set current tab to (make new tab with properties {URL:"https://www.macstories.net"})
end tell
end tell

I was pretty happy with this setup, but I knew I also wanted to come up with a way to enable and disable the Accessibility keyboard by pressing a single hotkey.7 Unfortunately, the macOS AppleScript dictionary does not have native support for activating the Accessibility Keyboard, so I had to turn to the inelegant, unreliable, but sometimes effective world of GUI scripting. This means I had to write AppleScripts that simulate clicking elements in the macOS UI without having to do it myself; effectively, I’m letting a script “interact” with the interface in a programmatic fashion to save a bit of time.

In practice, the final product looks like this:

These two hotkeys are based on AppleScripts that contain a bunch of ugly, flimsy GUI scripting code to open System Preferences, select the Accessibility tab, scroll down to the Keyboard section, and toggle the state of the Accessibility Keyboard setting so I don’t have to do all this myself manually every time. Here’s the code8 to enable the Accessibility Keyboard:

tell application "System Preferences"
reveal pane id "com.apple.preference.universalaccess"
delay 1
tell application "System Events"
tell window 1 of application process "System Preferences"
select table 1 of scroll area 1
delay 0.1
select row 16 of table 1 of scroll area 1
delay 0.1
end tell
tell tab group 1 of group 1 of window 1 of application process "System Preferences"
click radio button 2
delay 0.1
click checkbox 1
delay 0.2
end tell
end tell
quit
end tell

And here’s the AppleScript to disable it:

tell application "System Preferences"
activate
reveal pane id "com.apple.preference.universalaccess"
delay 1
tell application "System Events"
tell window 1 of application process "System Preferences"
select table 1 of scroll area 1
delay 0.1
select row 16 of table 1 of scroll area 1
delay 0.1
end tell
tell tab group 1 of group 1 of window 1 of application process "System Preferences"
click radio button 2
delay 0.1
click checkbox 1
delay 1
end tell
tell window 1 of application process "System Preferences"
click button 1 of sheet 1
end tell
end tell
quit
end tell

I’m not happy with the GUI scripting approach, of course: unlike native AppleScript, it’s tied to the interface, therefore if Apple changes even a subtle element of a window or menu in a macOS update, these scripts are going to break. However, both scripts get the job done and are reasonably fast. Even better, researching all this led me to discover UI Browser for Mac, an amazing utility that lets you inspect any visual element of the Aqua GUI, browse the hierarchy of windows and menus, and see what their AppleScript representation should be written like.

This is how I navigated the structure of System Preferences for GUI scripting. (Tap for full-size image.)

As you might imagine, I went down the rabbit hole with all of this for a few weeks, but I’m happy with the final result. The scripts to toggle the Accessibility Keyboard panel work great, and I’ve learned a few things about GUI scripting that might come in handy down the road. If you want to automate a Mac app that doesn’t natively support AppleScript, I highly recommend giving UI Browser a try to see what you can come up with.

The “shortcuts bar” that I created using the Accessibility Keyboard for macOS has quickly become one of my favorite enhancements to the everyday Mac experience whether I’m using macOS from the Mac mini or the iPad Pro via Luna Display. It’s a testament to Apple’s commitment to automation and the Mac’s greatest advantage over iOS – the complete freedom to personalize the operating system and truly make it your own.

Finally, here is a short video showing how I can use Luna Display as a secondary display for the Mac mini (which is in another room) while taking advantage of keyboard shortcuts and the Accessibility Keyboard panel:

Using Luna Display as a secondary display with the help of BetterTouchTool. (Tap volume icon for sounds.)

Luna Display

The idea of using “macOS as an app” seemed ridiculous to me when I first heard of Luna Display years ago, but now that it’s become part of my workflow and daily routine, it feels obvious. Even though macOS was not designed for multitouch and using it from an iPad will never be a substitute for the real experience of using a Mac, Luna Display is the closest I was able to get to owning a hybrid Apple device that “runs” both iOS and macOS. Despite the occasional slowdowns or latency issues, the illusion created by Luna Display – this idea that you can have two OSes in one Apple device – is so strong, it feels like a natural complement to the iPad Pro.

Perhaps someday we’ll have an Apple laptop running a future operating system that blends the best of both worlds – the sheer ingenuity of iOS and its vibrant app ecosystem, and the wisdom, deep personalization, and technical prowess of macOS. I, for one, cannot wait for that future to become our new reality. But until that happens, Luna Display is the best workaround I’ve found to date, and it’s one of my favorite tech purchases of the past few years.

Although I've been working on fixing this aspect as well, and I should have more to share soon. ↩

A major downside of Luna Display is the lack of audio passthrough to the iPad. Any audio or sound effect that would normally play on the Mac will not play on the iPad connected via Luna Display. This isn't a big deal for me because whenever I listen to music on my Mac, I do it with iTunes (which is always streaming audio to one or more HomePods), but it's worth mentioning. ↩

Luckily, June isn't that far now. ↩

I'm pretty sure SwitchResX could do this, but I don't feel comfortable disabling System Integrity Protection just for this. If you know of any other utility that can do this, please let me know. ↩

When you switch between iOS apps with Luna Display running, the connection to the Mac is usually kept alive for a few minutes. I can switch back and forth between, say, Shortcuts and Luna Display without issues. ↩

I adapted the iCloud Drive script from this one. ↩

If you're on a Mac, you can also enable an Accessibility Keyboard setting that lets you "dwell" on a hot corner to toggle the visibility of a panel. I use this option when I'm at my Mac mini, but the Luna Display doesn't have a cursor, therefore I can't hover over a corner of the screen to quickly toggle the Accessibility Keyboard. ↩

The basic template for these scripts was likely taken from StackOverflow, but I don't remember the original source, and I also ended up modifying them a lot for the latest release of Mojave. ↩