At some point a few years ago, my AppleTV could no longer connect to the iTunes library running on OS X 10.5 - an event I really couldn’t be annoyed at. Honestly, it kept working for longer than I thought it would. So, I replaced my beloved PowerMac G5 with a shiny new Mac mini. Even though most of my iTunes-ing (now TV-ing) done on that new machine is scripted and self-sufficient, I end up Screen Sharing with my (headless) Mac mini pretty often. I was annoyed enough with constant opening the Screen Sharing app and typing in the hostname of my Mac mini to create a Shortcut to screen share with just a keystroke. You can download it here.
The Shortcut itself runs an AppleScript that opens the Screen Sharing application built-in to macOS (which is hidden in
/System/Library/CoreServices/Applications), types in your hostname, and hits enter. If you have this password saved in your Keychain, you won’t even be prompted for a password (although please consider the security implications of doing so - this computer doesn’t do anything but run the TV app and it’s not connected to the internet).
When installing this Shortcut, it will ask you to input the sharing name of the computer you want to Screen Share with (you can find this in System Preferences in “Sharing” if you don’t know what it is). You can edit that yourself after installing (or extend it to provide a dropdown - something I’ve not needed, but was tempted to do anyway). You’ll need to make sure Shortcuts and
siriactionsd can control your computer in “Security & Privacy” in System Preferences to allow it to work. You’ll also want to change the name of the Shortcut from using “Mac Mini”, unless you’re connecting to one too. 🙂
As a bonus, you can set this Shortcut to be pinned in the Menu Bar and set a global shortcut in the Shortcuts UI, as I did. I picked
⌃⌥⌘S, which is both unlikely to have a conflict and is also pretty fun to press.
Happy Screen Sharing!