Control macOS touchbar media keys

Using the CGEventTap way, I am able to intercept the media keys (F7 - F9) in my application and prevent stuff like iTunes from opening. However, is there a way to change the icon that's displayed? For example, when playing a youtube video in safari or music in iTunes, the button will change from 'play' to 'pause' as appropriate, but in my case it remains as the generic 'play/pause' button.

There's clearly an API to do this, but I haven't found it yet.

Read more here:

Content Attribution

This content was originally published by zhiayang at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: