https://github.com/mrmekon/touchtest
MacOS Touch Bar Control Strip daemon
https://github.com/mrmekon/touchtest
cli cocoa command-line control-strip controlstrip daemon macos objective-c touch-bar touchbar
Last synced: 2 months ago
JSON representation
MacOS Touch Bar Control Strip daemon
- Host: GitHub
- URL: https://github.com/mrmekon/touchtest
- Owner: mrmekon
- License: apache-2.0
- Created: 2017-07-04T12:59:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-04T13:21:28.000Z (over 8 years ago)
- Last Synced: 2025-02-28T17:51:05.178Z (7 months ago)
- Topics: cli, cocoa, command-line, control-strip, controlstrip, daemon, macos, objective-c, touch-bar, touchbar
- Language: Objective-C
- Size: 26.4 KB
- Stars: 22
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TouchTest - MacOS Touch Bar Control Strip daemon
Example of adding an icon to the Control Strip region of the Mac Touch Bar using
a headless/UI-less background app. Icon is always displayed, regardless of which
app is in the foreground.Uses a private API, not suitable for the App Store.
No XCode project, no Nib/Xib, builds from command-line. Just the minimum
necessary to add an always-available button to the Control Strip.
Inspired by: https://github.com/a2/touch-baer
## Usage
### Build
```
$ make
```### Build and launch
```
$ make run
```### Kill running daemon
```
$ make kill
```### Cleanup
```
$ make clean
```### Design Notes
Links against private framework DFRFoundation.
Uses two DFRFoundation functions: ```DFRElementSetControlStripPresenceForIdentifier``` and ```DFRSystemModalShowsCloseBoxWhenFrontMost```
Uses private NSTouchBarItem method: ```+(void)addSystemTrayItem:(NSTouchBarItem *)item;```
Uses private NSTouchBar method: ```+(void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSString *)identifier;```
Simply creates a windowless NSApplication and an NSApplicationDelegate implementing the private functions.
**MUST** execute from a mac _.app_ bundle. The TouchBar service doesn't seem to communicate with a binary when launched outside of a bundle. I did not investigate why.