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.shto~/binand make sure it's executable. Make sure it points to an existingnodeexecutable and where you copied the gist repo. - Open the
.scptfile with AppleScript editor and make sure it points to the.shfile. - Make sure the
.plistpoints to where your Apple script file is located. You can change the poll interval (default 10s) by changing theStartIntervalvalue. - Link the
.plistfile to~/Library/LaunchAgents/ - Start it by running
launchctl load -w ~/Library/LaunchAgents/fi.mumakil.luxafor_spotify.plist