Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

TouchBar Display

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.

Build & run

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 run

The 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.

How it works

  • Touch Bar — an NSTouchBar with an NSCustomTouchBarItem wrapping a custom NSView that draws the message in draw(_:) (30 pt strip height, NSAttributedString text, NSBezierPath pill background). The bar is set on NSApp.touchBar, and a floating NSPanel (.utilityWindow, isFloatingPanel, .floating level) overrides makeTouchBar() so the bar is present while the helper window has focus.
  • Control Strip — the private DFRFoundation framework is loaded via dlopen, DFRElementSetControlStripPresenceForIdentifier / DFRSystemModalShowsCloseBoxWhenFrontMost are resolved with dlsym, 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 NSBitmapImageRep at 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages