Minimal proxy script for arch and arch based distributions for fish users. Sets or unsets proxy depending on the connected WiFi.
It is a good idea to export the variable $XDG_CONFIG_HOME even if you use the default ~/.config/ directory. Add set -gx XDG_CONFIG_HOME /path/to/config/dir/ to your config.fish if you haven't already. Then add the following line to your config.fish:
source /path/to/proxer.fishOr alternatively, run the following commands.
curl "https://raw.githubusercontent.com/ayan7744/proxer.fish/master/proxer.fish" > ~/.local/bin/proxer.fish
echo "set -gx XDG_CONFIG_HOME ~/.config/" >> ~/.config/fish/config.fish
echo "source ~/.local/bin/proxer.fish" >> ~/.config/fish/config.fishMake the file /etc/sudoers.d/05-proxer with the following contents to pass proxy environment variables to programs when using sudo:
Defaults env_keep += "*_proxy *_PROXY IS_PROXY_ON"The script sources the file $XDG_CONFIG_HOME/proxer.rc.fish everytime. Create the file $XDG_CONFIG_HOME/proxer.rc.fish with the following contents
set wifi_SSID "Some wifi name"
set proxy_host "192.168.3.10"
set proxy_port "3128"
set username "myuser"
set password "mypassword"
set proxy_address "http://$username:$password@$proxy_host:$proxy_port/"Don't forget to URL encode your username and password in proxy_address variable.
- NetworkManager