Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there programable access to the Control Strip of the macOS Touch Bar?

The Control Strip is the static and global part of the macOS Touch Bar which is always visible in every context and app. While Apple provides full documentation about how to use the API to provide a contextual App Region in your macOS app, I couldn't find any notice about how to add stuff to the Control Strip.

I could think of a lot of nice tools and actions which would be nice to have it always just a finger tip away, so I was wondering if we (the developers) are able to advance the Control Strip too? Is there any documentation or did anybody figure it out himself how to work wit Control Strip items?

like image 754
miho Avatar asked Oct 28 '16 14:10

miho


2 Answers

There is in fact a "private, undocumented" API that can be used, as you can see if you follow the link in the Related comment on your question (to this question). The following GitHub repository provides a succinct, functional example, highlighting these as the key elements:

DFRElementSetControlStripPresenceForIdentifier(NSString *, BOOL);
DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL);

+[NSTouchBarItem addSystemTrayItem:]
+[NSTouchBar presentSystemModalFunctionBar:systemTrayItemIdentifier:]

However, I don't think it's problem-free at this point. For instance, buttons you add there won't be selectable when modifying the control strip buttons (which means it won't play well with other apps that try to use it as well).

Looking forward to Apple making this legit for us!

like image 159
Bilal Akil Avatar answered Sep 28 '22 08:09

Bilal Akil


There is no public API or supported way to add items to the control strip.

like image 34
Taylor Avatar answered Sep 28 '22 09:09

Taylor