Touch Bar Gesture - Scroll through track

I made this Touch Bar gesture to scroll through Spotify or iTunes tracks. You could always make it work for other apps too.
Make two widgets (left & right) with 2/3/4/5 finger gesture and any modifiers you want.

Set predefined action to applescript in background. Use this script:

-- Scroll through Spotify or iTunes track
on bttWidgetSliderMoved(percentageMoved)
if application "Spotify" is running then
tell application "Spotify"
set SongPos to player position -- of current track
set player position to (SongPos + percentageMoved * 100)
end tell
else if application "iTunes" is running then
tell application "iTunes"
set SongPos to player position -- of current track
set player position to (SongPos + percentageMoved * 100)
end tell
end if
end bttWidgetSliderMoved

Thanks for your tip. but I don't how to use it.. can you show some example?

I've set mine to 2 Finger Swipe Left & Right with Shift modifier, with Repeats after position has changed 1%. So, if I hold down shift & use 2 fingers on the Touch Bar to swipe right, it skips through the current song 1 second for every 1% moved relavtive to the Touch Bar surface. Swipe left, and it moves backwards through the song. Lets me scroll through a song faster or slower and more easily than if I created a button to skip ahead/back every 5 or so seconds.

I've made similar gestures for screen brightness & volume level, microphone volume level.
Here's the JSON for the Swipe Left one. Just need 2 of them with one set to Swipe Right.
https://share.folivora.ai/sharedPreset/d90bb276-4e82-49f8-a60d-c1b416f3477c

2 Likes

Nice widget! I implemented it in my touchbar :smile:. The only thing I miss is to see in which second of the song you are in each moment while scrolling (or maybe the remaining seconds). Any idea on how to add this?

1 Like