On new MacBooks with TouchBar, when you open a media app an extra button for media control appears along with 4 fixed shortcuts. But sometimes it does not appear. It is due to system killing "nowPlayingTouchUI" service which is responsible to control the extra button.
-
Clone/Download the repository.
-
In most of the cases you only need to double click on 'Start NowPlayingTouchUI' to start 'nowPlayingTouchUI' service but if the service is already running and you are having problem, run 'Restart NowPlayingTouchUI' and then 'Start NowPlayingTouchUI'.
tell application "NowPlayingTouchUI"
activate
end tell
tell application "NowPlayingTouchUI"
quit
end tell