These are two commands for switching the Spotify proxy on and off, as Spotify doesn't automate it for you. Also bundled are some aliases you can use to switch from the command line.
- Make sure you have your proxy settings set up and set to 'HTTP' or 'No Proxy'
- Download the two
.command
files - Save them somewhere sensible
- Make sure they are executable (Move to the directory you saved them in and
chmod +x Spotify_Proxy_Off.command Spotify_Proxy_On.command
)
Now you can proxy switch from Spotlight by searching Spotify Proxy On
and Spotify Proxy Off
🤗
The use of pgrep
and pkill
is not bulletproof but it is fast!
Tnx for this.
Rewrote a couple of lines to make this switcher ping an internal network and put proxy on or off from the response.
#!/bin/bash
if ping -c 1 "some internal host" &> /dev/null
then
pkill Spotify
sed -i -e "s/network.proxy.mode=1/network.proxy.mode=2/" ~/Library/Application\ Support/Spotify/prefs
open -a Spotify
else
pkill Spotify
sed -i -e "s/network.proxy.mode=2/network.proxy.mode=1/" ~/Library/Application\ Support/Spotify/prefs
open -a Spotify
fi