如何获得在右侧触摸条控制中心的项目? [英] How get an item in control center of Touch Bar on the right?
本文介绍了如何获得在右侧触摸条控制中心的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
该应用TouchSwitcher添加lightscreen和体积项旁项: https://hazeover.com/touchswitcher.html
The app TouchSwitcher add item beside lightscreen and volume items : https://hazeover.com/touchswitcher.html
是否有触摸栏右侧区域显示项目到控制带材中的溶液
Is there a solution to display an item into the control strip on the right region of touch bar ?
我找不到关于它的官方文档中的任何帮助... 请帮帮我!
I can't find any help in official documentation about it... Please help me !
推荐答案
下面的我用.传递一个
@import Cocoa;
@import Foundation;
// See: https://github.com/a2/touch-baer
extern void DFRElementSetControlStripPresenceForIdentifier(NSString *string, BOOL enabled);
@interface NSTouchBarItem ()
+ (void)addSystemTrayItem:(NSTouchBarItem *)item;
@end
@interface NSTouchBar ()
+ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSString *)identifier;
@end
void controlStrippify(NSView *view, NSString *identifier) {
if (@available(macOS 10.12.2, *)) {
NSCustomTouchBarItem *touchBarItem = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
touchBarItem.view = view;
[NSTouchBarItem addSystemTrayItem:touchBarItem];
DFRElementSetControlStripPresenceForIdentifier(identifier, YES);
} else {
// Fail!
}
}
这篇关于如何获得在右侧触摸条控制中心的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文