macoscocoanstouchbar

Getting rid of icons on NSTouchBar


I am creating a NSTouchBar for my app. When the bar displays, I see this ESC icon on the left and these other icons on the right:

enter image description here

Is there a way to get rid of them and have the full bar area available?


Solution

  • The icons on the right are the "control strip".

    The "esc" key and the "control strip" on the right can't be removed via public APIs. In the documentation they say it's "always available".

    You can change the content of "esc" to something else, though, like "done" or anything, even an icon, by using escapeKeyReplacementItemIdentifier with the NSTouchBarItem.

    There's ways to customize the control strip and even to remove it, but I didn't find any public API for that: Apple considers that this choice should be left to the user, via the system preferences, and can't be forced programmatically.