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

落花浮王杯 提交于 2019-11-30 12:00:21

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!

Taylor

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!