So long ✌️ macOS Touch Bar
November 25, 2023 | Next part |
The much-maligned macOS Touch Bar seems to have been confirmed put out to pasture with the release of the late 2023 MacBook Pro.
The Touch Bar was introduced in the 2016 MacBook Pro and included in every iteration of the 13-inch model until it was phased out in 2022. It was most significantly featured in the 13-inch M1 MacBook Pro, the flagship model for Apple’s new silicon chip, which is where I was exposed to the curious technology.
First encounters: Worse than useless!
When I encountered the Touch Bar, it was a major hindrance. I found the volume controls unintuitive, the prominent typing suggestions insulting, and the stupid, smiling emoji-face loathsome.
A dedicated button emoji-picker button became a symbol for the mishandling of the technology. It showed how unaligned the Apple product managers had become from the Pro user base. But, like the Joni Mitchell song says:
🎶🎤🎸 Don’t it always seem to go, that you don’t know what you got till it’s gone 🎸🎵🎶
ASK ME HOW I TYPED THOSE EMOJIS
On second thought: Let Tim Cook..
My interest was piqued one day when I saw someone editing a video and noticed how the video playback appeared on the mini-screen. It showed a little thumbnail of the frame, and you could gesture your way through to change your position in the video.
Looking further, I noticed you could easily trim a video in QuickTime with the Touch Bar in a workflow similar to iPhone video editing:
I liked the idea of using the Touch Bar to view photos, so I opened a series of images in the Photos app, which provided a cool means of scrolling through image thumbnails.
This led me to research what other app developers have done with the technology. The Apple-native apps like Logic and Final Cut have deeply enhanced Touch Bar workflows. Even Microsoft bought in and enhanced their apps to support Touch Bar workflows for each Office product.
One distinct feature of Apple’s browser, Safari, is that the Touch Bar displays a preview image of each open tab which you can use to switch tabs. Also in Safari, when you watch YouTube videos, you can use the Touch Bar to fast-forward through videos (including ads!)– a neat little hack that I pray Google will never patch.
9to5Mac
has a great write-up of the efforts and capabilities that have been enabled and developed for the Touch Bar.
In my opinion, one of the most useful app enhancements can be found in Terminal. When you type a command, a button appears allowing you to lookup the command’s man
page in a new terminal window.
Getting to know your Touch Bar
The
MacBook Pro Touch Bar,
by default, displays an expandable region on the right side called the Control Strip that includes controls for performing system-level tasks such as invoking Siri, adjusting the brightness of the main display, and changing the volume.
App-specific controls, located in the App Region, comprise the segment of the screen to the left of the Control Strip.
For the 1st Gen. Touch Bar, the left edge of the screen features a non-reconfigurable Escape key, which eats into the space available for the App Region.
How do I know if I have a Touch Bar?
Okay, it’s plain to see if you have a Touch Bar.
The more important question is: how does my Mac know it has a Touch Bar?
This is less clear. It’s not well-documented by Apple and there’s no public API method called hasTouchBar?
.
If you have a Touch Bar Mac, if you look at your System Report under Hardware > SPI, you will see Touch Bar Display is listed.
The Touch Bar can also be identified using the system_profiler SPSPIDataType
command. system_profiler
allows you to store the output as JSON, and plutil
allows you to traverse JSON to extract a value. Here’s an example script to print the system name of the Touch Bar:
SPIDataType=$(system_profiler SPSPIDataType -json)
echo $SPIDataType
{
"SPSPIDataType" : [
{
"_name" : "Apple Internal Keyboard / Trackpad",
"a_product_id" : "0x0341",
"b_vendor_id" : "0x05ac (Apple Inc.)",
"c_stfw_version" : "1.75",
"d_serial_num" : "FM7121200T7N4L2AV+RRN",
"f_manufacturer" : "Apple Inc.",
"g_location_id" : "0x00000027",
"h_mtfw_version" : "5.29"
},
{
"_name" : "Touch Bar Display",
"g_location_id" : "0x00000023",
"h_mtfw_version" : "4.68"
}
]
}
plutil -extract SPSPIDataType.1._name raw -o - - <<< "$SPIDataType"
Touch Bar Display
Note: I had no idea what SPI meant. It turns out, in this case, it means Serial Peripheral Interface,
which is similar to a USB. On my non-Touch Bar MacBooks, there is only one SPI device:
Apple Internal Keyboard / Trackpad
.
If your MacBook doesn’t have a Touch Bar, you can enable a Virtual Touch Bar by opening Xcode and selecting Window > Touch Bar > Show Touch Bar, or by pressing SHIFT + CMD + 8 with Xcode open.
Customize the Touch Bar
You can customize the Touch Bar (or Virtual Touch Bar) from System Preferences > Keyboard > Touch Bar Settings. This
MacRumors article
has a lot of good information on the subject.
Using Touch Bar Settings, you can do things like remove Siri from the Control Strip and disable typing suggestions (which I would suggest doing).
The Customize Control Strip window is interesting. You use the mouse to drag icons down to the Touch Bar. This works for the Virtual Touch Bar as well. To my knowledge, there are no other instances of using the mouse to interact with the Touch Bar in any (native) Apple apps. Imagine seeing the mouse cursor in the Touch Bar?
💡 Writing an app to show the Dock on the Touch Bar would be a cool way to reclaim some screen space. Allowing the mouse to interact with those app icons on the Touch Bar would be even cooler.
Touch Bar Availability
The Touch Bar was featured in these machines:
1st Generation Touch Bar
- 13-inch MacBook Pro (2016, 2017, 2018, 2019)
- 15-inch MacBook Pro (2016, 2017, 2018, 2019)
Note: The 2016 and 2017 entry-level 13-inch models with two Thunderbolt 3 ports did not feature the Touch Bar.
2nd Generation Touch Bar
- 13-inch MacBook Pro (Intel 2020, M1 2020, M2 2022)
- 16-inch MacBook Pro (Intel 2019)
The Touch Bar was only featured on Apple-Silicon MacBook Pros of the 13-inch form. The 14 and 16-inch Apple-Silicon machines were never blessed with the Touch Bar.
So what’s next?
Well, we’re gonna build an app using Touch Bar, naturally. So think twice before you trade-in that old M1 for an M3 Pro.
Let’s dust off these relics of a bygone age and show them some proper appreciation. One app that was curiously never updated to support a Touch Bar workflow was Photo Booth, a MASSIVE oversight in my opinion.
So using the conceit of creating a Touch Bar-based version of Photo Booth, we’re not only going to learn how to program for the Touch Bar, but we’re also going to:
- Use the macOS
AVFoundation
library to capture output from the iSight camera (and possibly from iPhone sources as well) and display it on screen. - Explore the
Core Image
library and its many built-inCIFilter
objects, which provide basic image filters that can be further customized. - Take photos and save them to your Photo Library or Pictures directory.
So let’s go to macOS Touch Bar Photo Booth!