This presets shows the currently playing track in Spotify and a play/pause button as well as a skip button in the menubar. A click on the text opens Spotify.
Might not look as good on MacBooks without a notch.
The preset should be put in a conditional activation group which is activated if Spotify is running ("List of running processes contains Spotify"). Copy the code below (three menubar items) in that CAG under "Automations, Named and Other Triggers".
The play/pause and skip buttons use SF Symbols, so I think the Apple SF Symbols app might have to be installed for the preset to work?
You can change the max number of characters shown for title and artist each by editing the ideallength variable.
Let me know if you encounter problems or have feedback
[
{
"BTTLastUpdatedAt" : 1712152460.052115,
"BTTTriggerType" : 674,
"BTTTriggerTypeDescriptionReadOnly" : "Menubar Item: Next Track",
"BTTTriggerTypeDescription" : "Next Track",
"BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
"BTTUUID" : "8AED73DD-FCDC-44C0-BBF1-56A6137C6ECB",
"BTTPredefinedActionType" : 195,
"BTTPredefinedActionName" : "Run Apple Script (async in background)",
"BTTInlineAppleScript" : "if application "Spotify" is running then\r\ttell application "Spotify"\r\t\ttry\r\t\t\tnext track\r\t\tend try\r\tend tell\rend if",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTOrder" : 1,
"BTTGestureNotes" : "Next Track",
"BTTTriggerConfig" : {
"BTTTouchBarButtonLineHeight" : 0,
"BTTTouchBarItemIconWidth" : 22,
"BTTTouchBarButtonTextAlignment" : 0,
"BTTTouchBarItemSFSymbolDefaultIcon" : "forward.fill",
"BTTTouchBarButtonTopMargin" : 0,
"BTTTouchBarButtonColor" : null,
"BTTTouchBarFontColor" : null,
"BTTTouchBarScriptUpdateInterval" : 0,
"BTTTouchBarAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 0.000000",
"BTTTouchBarAppleScriptStringRunOnInit" : false,
"BTTTouchBarButtonFontSize" : 15,
"BTTTouchBarOnlyShowIcon" : true,
"BTTTouchBarAppleScriptUsePath" : 0,
"BTTTouchBarItemIconType" : 2,
"BTTTouchBarItemIconHeight" : 20,
"BTTTouchBarButtonBaselineOffset" : 0
}
},
{
"BTTLastUpdatedAt" : 1712152460.06955,
"BTTTriggerType" : 680,
"BTTTriggerTypeDescriptionReadOnly" : "Menubar Item: Play/Pause (Script)",
"BTTTriggerTypeDescription" : "Play/Pause (Script)",
"BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
"BTTUUID" : "5EE7C8D8-2037-4E86-B7BD-78F4E3666F50",
"BTTPredefinedActionType" : 195,
"BTTPredefinedActionName" : "Run Apple Script (async in background)",
"BTTAdditionalActionData" : {
"BTTScriptType" : 0,
"BTTAppleScriptRunInBackground" : true,
"BTTTouchBarAppleScriptString" : "if application "Spotify" is running then\r\ttell application "Spotify"\r\t\ttry\r\t\t\tplaypause\t\t\r\t\tend try\r\tend tell\rend if",
"BTTTouchBarAppleScriptUsePath" : false
},
"BTTInlineAppleScript" : "if application "Spotify" is running then\r\ttell application "Spotify"\r\t\ttry\r\t\t\tplaypause\t\t\r\t\tend try\r\tend tell\rend if",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTOrder" : 2,
"BTTGestureNotes" : "Play/Pause (Script)",
"BTTTriggerConfig" : {
"BTTTouchBarButtonColor" : null,
"BTTTouchBarAppleScriptStringRunOnInit" : true,
"BTTTouchBarFontColorAlternate" : null,
"BTTScriptType" : 0,
"BTTTouchBarButtonMonoSpace" : 0,
"BTTTouchBarScriptUpdateInterval" : 2,
"BTTTouchBarButtonBaselineOffset" : 0,
"BTTTouchBarButtonLineHeight" : 0,
"BTTTouchBarItemSFSymbolDefaultIcon" : "play.fill",
"BTTTouchBarItemIconHeight" : 20,
"BTTTouchBarButtonTextAlignment" : 0,
"BTTTouchBarAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 0.000000",
"BTTTouchBarAppleScriptUsePath" : 0,
"BTTTouchBarItemIconType" : 2,
"BTTTouchBarColorRegex" : "^playing",
"BTTTouchBarItemIconWidth" : 22,
"BTTTouchBarButtonTopMargin" : 0,
"BTTTouchBarButtonFontSize" : 15,
"BTTTouchBarFontColor" : null,
"BTTTouchBarAppleScriptString" : "if application "Spotify" is running then\r\ttell application "Spotify"\r\t\ttry\r\t\t\treturn player state as text\r\t\tend try\r\tend tell\r\nelse\n\treturn ""\nend if",
"BTTTouchBarOnlyShowIcon" : true,
"BTTTouchBarItemSFSymbolAlternateIcon" : "pause.fill"
}
},
{
"BTTLastUpdatedAt" : 1712152460.052141,
"BTTTriggerType" : 680,
"BTTTriggerTypeDescriptionReadOnly" : "Menubar Item: Now Playing",
"BTTTriggerTypeDescription" : "Now Playing",
"BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
"BTTUUID" : "7103A0C3-6D84-4685-B1E2-87E199B5B33B",
"BTTPredefinedActionType" : 49,
"BTTPredefinedActionName" : "Launch Application / Open File / Start Apple Script …",
"BTTLaunchPath" : "file:///Applications/Spotify.app",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTOrder" : 4,
"BTTGestureNotes" : "Now Playing",
"BTTTriggerConfig" : {
"BTTScriptType" : 0,
"BTTTouchBarButtonLineHeight" : 0,
"BTTTouchBarItemIconWidth" : 22,
"BTTTouchBarButtonTextAlignment" : 3,
"BTTTouchBarButtonColor" : null,
"BTTTouchBarButtonTopMargin" : 0,
"BTTTouchBarAlternateBackgroundColor" : null,
"BTTTouchBarFontColor" : null,
"BTTTouchBarScriptUpdateInterval" : 3,
"BTTTouchBarButtonMonoSpace" : 0,
"BTTTouchBarAppleScriptStringRunOnInit" : true,
"BTTTouchBarAppleScriptString" : "if application "Spotify" is running then\r\ttry\r\t\ttell application "Spotify"\r\t\t\t\r\t\t\tset ideallength to 7\r\t\t\t\r\t\t\tset track1 to name of the current track\r\t\t\tset artist1 to artist of the current track\r\t\t\tif artist1 is equal to "" then\r\t\t\t\tif (length of track1 is greater than (ideallength * 2)) then\r\t\t\t\t\tset track1 to (text 1 thru (ideallength * 2 - 5) of track1) & "…"\r\t\t\t\tend if\r\t\t\t\t\r\t\t\t\treturn track1\r\t\t\t\t\r\t\t\tend if\r\t\t\t\r\t\t\tif (length of track1 is greater than ideallength) then\r\t\t\t\tset track1 to (text 1 thru (ideallength - 1) of track1) & "…"\r\t\t\tend if\r\t\t\tif (length of artist1 is greater than ideallength) then\r\t\t\t\tset artist1 to (text 1 thru (ideallength - 1) of artist1) & "…"\r\t\t\tend if\r\t\t\t\r\t\t\treturn track1 & " • " & artist1\r\t\t\t\r\t\tend tell\r\tend try\rend if\r\r",
"BTTTouchBarButtonFontSize" : 12,
"BTTTouchBarOnlyShowIcon" : false,
"BTTTouchBarAppleScriptUsePath" : 0,
"BTTTouchBarItemIconType" : 2,
"BTTTouchBarItemIconHeight" : 22,
"BTTTouchBarButtonBaselineOffset" : 0,
"BTTTouchBarFontColorAlternate" : null,
"BTTTriggerRestrictions" : "Quit Spotify"
}
}
]