MTMR
MTMR copied to clipboard
Now playing would catch all music apps
When we use the now playing info, all music apps which provide data in the notification player would be shown in the touchbar. More information: https://stackoverflow.com/questions/61574238/swift-macos-retrieving-track-title-and-artist-of-currently-playing-music
I've managed to get this info from Now Playing widget in Notification Centre using Apple Script. But it has a big downside as the focus from current app gets lost every time the script executes.
tell application "System Events" to tell process "ControlCenter"
set track to ""
tell menu bar item "Now Playing" of menu bar 1 to click
tell group 1 of window "Control Centre"
repeat with i from 1 to (count UI elements)
if (name of UI element i = "pause") then set track to name of UI element (i - 1)
end repeat
end tell
tell menu bar item "Now Playing" of menu bar 1 to click
track
end tell