Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alfred2 workflow for Gear Music Player

An Alfred2 workflow for the Gear Music Player

The player currently exposes some functionality via the gear:// url scheme.

gear://togglePlay
gear://play
gear://pause
gear://previous
gear://next
gear://rate?5

where rate accepts integers in the range 0,...,5 with 5 being a thumbs up, 1 a thumbs down, and 0 removing the rating.

This workflow exposes the commands play, pause (both toggle playback), as well as next and previous. As for the rating system, I personally do not use five stars, but rather just up, down, and none.

You can download the compiled workflow file or keep reading if you'd like to set things up yourself.

A convenient way to control the application is to use the open -g command, which will not raise the application window. As such, set up your desired keywords in the Alfred workflow editor, and run a script such as open -g gear://togglePlay. You may want to check out the rating script.

query="{query}"
url="gear://rate?"
if [ "$query" = "up" ]; then
url+="5"
elif [ "$query" = "down" ]; then
url+="1"
elif [ "$query" = "none" ]; then
url+="0"
else
url+=$query
fi
open -g $url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment