-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitchProxy.sh
More file actions
executable file
·50 lines (38 loc) · 1.99 KB
/
switchProxy.sh
File metadata and controls
executable file
·50 lines (38 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# Created by - Akshat Malviya, Feb 23 2019
# This script helps quickly toggle between proxy settings for a local network. I made it for my college's WiFi network.
curr_mode=$(gsettings get org.gnome.system.proxy mode)
curr_proxy=$(gsettings get org.gnome.system.proxy.https host)
if [ $curr_mode = "'manual'" ] && [ $curr_proxy = "'10.8.0.1'" ]
then
echo 'Switching proxy to "none".'
gsettings set org.gnome.system.proxy mode 'none'
notify-send --urgency=critical --expire-time=500 switchProxy "Proxy switched to 'none'."
elif [ $curr_mode = "'manual'" ] && [ $curr_proxy = "''" ]
then
echo 'Switching proxy to "none".'
gsettings set org.gnome.system.proxy mode 'none'
notify-send --urgency=critical --expire-time=500 switchProxy "Proxy switched to 'none'."
elif [ $curr_mode = "'none'" ]
then
echo 'Switching proxy to "10.7.0.1:8080".'
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.https host '10.7.0.1'
gsettings set org.gnome.system.proxy.https port '8080'
gsettings set org.gnome.system.proxy.http host '10.7.0.1'
gsettings set org.gnome.system.proxy.http port '8080'
gsettings set org.gnome.system.proxy.ftp host '10.7.0.1'
gsettings set org.gnome.system.proxy.ftp port '8080'
notify-send --urgency=critical --expire-time=500 switchProxy "Proxy switched to '10.7.0.1:8080'"
elif [ $curr_proxy = "'10.7.0.1'" ]
then
echo 'Switching proxy to "10.8.0.1:8080".'
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.https host '10.8.0.1'
gsettings set org.gnome.system.proxy.https port '8080'
gsettings set org.gnome.system.proxy.http host '10.8.0.1'
gsettings set org.gnome.system.proxy.http port '8080'
gsettings set org.gnome.system.proxy.ftp host '10.8.0.1'
gsettings set org.gnome.system.proxy.ftp port '8080'
notify-send --urgency=critical --expire-time=500 switchProxy "Proxy switched to '10.8.0.1:8080'."
fi