Skip to content

Instantly share code, notes, and snippets.

@kadrach
Last active March 30, 2020 02:46
Show Gist options
  • Save kadrach/9f30a31d258389c557a9 to your computer and use it in GitHub Desktop.
Save kadrach/9f30a31d258389c557a9 to your computer and use it in GitHub Desktop.
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