This set of scripts will change your Luxafor light's colors based on your Spotify player's state. It polls every 10 seconds for Spotify's play state and changes the color accordingly (playing -> red, not playing -> green).
The script will record what color it set on the last run and will not set it again if it does not change. This way you can manually override the setting and the script won't fight you before changing play states again.
- Checkout the files (I've used
~/Code/luxafor_toggle
) andnpm install
- Copy the
toggle_luxafor.sh
to~/bin
and make sure it's executable. Make sure it points to an existingnode
executable and where you copied the gist repo. - Open the
.scpt
file with AppleScript editor and make sure it points to the.sh
file. - Make sure the
.plist
points to where your Apple script file is located. You can change the poll interval (default 10s) by changing theStartInterval
value. - Link the
.plist
file to~/Library/LaunchAgents/
- Start it by running
launchctl load -w ~/Library/LaunchAgents/fi.mumakil.luxafor_spotify.plist