toggle touchbar buttons

Is there a way to create toggle buttons that toggle the state of something?
For example, toggle the Music app between play and pause
or toggle between show emojis and hide emojis?

Yes, there're plenty of ways to do it. I suggest you downloading goldenchaos or aquatouch preset to see how do the developers do it :wink:

To your questions:

  1. toggle play/pause: there's a built-in action called Play/Pause that can toggle any playing app.
  2. Use applescript/javascript to get trigger status and update trigger status.