How to hide or disable the whole touchBar?

Hi,


My mac app need to hide or disable the whole touchBar.

  1. What should I do to hide 'esc'?
  2. What should I do to hide 'the control strip'?
  3. What should I do to hide or disable the whole touchBar?


I have read the following official documents:


On the right side of the Touch Bar, the system supplies the always-available Control Strip. The Control Strip gives the user access to standard controls for display brightness, sound volume, Siri, and so on. Your app’s bars appear to the left of the Control Strip. The user can choose to hide the Control Strip, which gives the frontmost app the entire Touch Bar width. Read about how bars respond to available width in NSTouchBar Layout.


But, I do not know how to implement it with objc.

Accepted Reply

Have a look here, if it can help:


https://stackoverflow.com/questions/47988940/adding-button-to-nstouchbar-control-strip

Replies

Your post should better be in Cocoa section than Cocoa Touch.


Could you post the code (in Swift I guess) that you want to get in objc ?

Thank you very much.


Here are some methods without implements:


// macOS 10.14
+ (void)presentSystemModalTouchBar:(NSTouchBar *)touchBar placement:(long long)placement systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
+ (void)presentSystemModalTouchBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
+ (void)dismissSystemModalTouchBar:(NSTouchBar *)touchBar;
+ (void)minimizeSystemModalTouchBar:(NSTouchBar *)touchBar;

// macOS 10.13
+ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar placement:(long long)placement systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
+ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSTouchBarItemIdentifier)identifier;
+ (void)dismissSystemModalFunctionBar:(NSTouchBar *)touchBar;
+ (void)minimizeSystemModalFunctionBar:(NSTouchBar *)touchBar;


Many said those are private APIs, and I do not know how to use them because those are unuseful.

Or should I import some frameworks?


Thanks a lot.

Have a look here, if it can help:


https://stackoverflow.com/questions/47988940/adding-button-to-nstouchbar-control-strip