A tiny single-file, storyboard-free AppKit app for Touch Bar MacBook Pros (2016–2020): type a reminder into a small floating panel and it is drawn on the Touch Bar. A speech-bubble button is also installed into the always-visible Control Strip, so you can expand the message bar from any app.
Requires macOS with the Swift toolchain (Xcode or Command Line Tools) and a Mac with a physical Touch Bar.
make # swiftc -O -o TouchBarDisplay TouchBarDisplay.swift
make runThe app runs as an accessory (no Dock icon). Quit with ⌘Q while its panel is focused, and the Control Strip item is removed on exit.
- Touch Bar — an
NSTouchBarwith anNSCustomTouchBarItemwrapping a customNSViewthat draws the message indraw(_:)(30 pt strip height,NSAttributedStringtext,NSBezierPathpill background). The bar is set onNSApp.touchBar, and a floatingNSPanel(.utilityWindow,isFloatingPanel,.floatinglevel) overridesmakeTouchBar()so the bar is present while the helper window has focus. - Control Strip — the private
DFRFoundationframework is loaded viadlopen,DFRElementSetControlStripPresenceForIdentifier/DFRSystemModalShowsCloseBoxWhenFrontMostare resolved withdlsym, and the tray item is registered through the private+[NSTouchBarItem addSystemTrayItem:]/+[NSTouchBar presentSystemModalTouchBar:systemTrayItemIdentifier:]selectors. Every private call is guarded (dlsym != nil/responds(to:)) so the app degrades gracefully if the SPI disappears. - The Control Strip icon is rendered into an
NSBitmapImageRepat 2× pixel size with the logical point size assigned to the rep, for sharp Retina output.
⚠️ The Control Strip integration relies on private Apple API (the same SPI used by apps like Pock). It is fine for personal utilities but not App Store safe, and may break on future macOS releases.