MTMR icon indicating copy to clipboard operation
MTMR copied to clipboard

Fix for spotify song info for zsh users

Open pejrich opened this issue 2 years ago • 0 comments

it runs the command in bash which may make some of the commands fail and you just see "error". This fixed it for me, after much struggle to get a non-double quoted command(i'm not very good at bash, so if this can be improved, please let me know)

This doesn't handle non-alphanum song/artist names.

Add to ~/.bash_profile

spotifyInfo() { f=$(/usr/local/bin/spotify/SpotifyControl info); if [[ $f =~ Artist:\ +([A-Za-z0-9\ ]+).+Track:\ +([A-Za-z0-9\ ]+).+URI: ]]; then echo ${BASH_REMATCH[1]} - ${BASH_REMATCH[2]}; else echo "error";fi }

Change your "inline" to:

"inline": "source ~/.bash_profile; spotifyInfo",

pejrich avatar May 26 '22 14:05 pejrich