I wanted to add some simple buttons in the new fancy NSTouchBar for one of my projects:
However, I couldn’t find a quick and short introduction on how to use it without going full Objective-C, Swift or Xcode-path.
After some hacking I managed to put together a short version that people should be able to build upon. It will also play nice in C/C++ projects, since that is what most of my codebase is built on.
This will create a touchbar with one button, displaying “GLFW Rules”, when
ShowTouchBar() is called.
In the example I’m using GLFW, but it is also possible to uncomment the last part to get it working with other frameworks that does not supply the active
Here is a quick screenshot of the result of the example code above: