I refactored a FISH script to mute Spotify temporarily from the command line. The commercials were killing my concentration. I listen to instrumental tracks when I am coding. It used to turn the Macbooks volume off. Now it only turns Spotify's volume off in case I am watching a tut.
It started out using an NPM package, but I could not get it working that way so I went to sleep. I woke up with a new idea. I learned the osascript commands I needed by reading through the npm package Github repo.
Now my script gets the current volume, mutes Spotify, then raises the volume back to the original level after a while. 6 lines of code and no packages required 😄
I refactored a FISH script to mute Spotify temporarily from the command line. The commercials were killing my concentration. I listen to instrumental tracks when I am coding. It used to turn the Macbooks volume off. Now it only turns Spotify's volume off in case I am watching a tut.
It started out using an NPM package, but I could not get it working that way so I went to sleep. I woke up with a new idea. I learned the
osascript
commands I needed by reading through the npm package Github repo.Now my script gets the current volume, mutes Spotify, then raises the volume back to the original level after a while. 6 lines of code and no packages required 😄
Neat!
Thanks Jess 😊