2020-09-11 15:00:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Passwordless sudo required
|
|
|
|
|
2021-12-31 16:08:28 +00:00
|
|
|
res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|" -dmenu -i -p 'P ' "" -columns 9 -width 45 -l 1 -config /home/jpm/.config/rofi/config.rasi -theme /home/jpm/.config/rofi/sidebar -hide-scrollbar -eh 1 -location 0 -auto-select -no-fullscreen)
|
2020-09-11 15:00:39 +00:00
|
|
|
|
|
|
|
if [ $res = "Connection" ]; then
|
2020-11-23 09:35:26 +00:00
|
|
|
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
|
2020-09-11 15:00:39 +00:00
|
|
|
elif [ $res = "John.Me.tz" ]; then
|
2020-11-23 09:35:26 +00:00
|
|
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
|
|
|
sudo /usr/bin/systemctl restart wg-quick@wg0
|
2020-09-11 15:00:39 +00:00
|
|
|
elif [ $res = "MailCleaner" ]; then
|
2020-11-23 09:35:26 +00:00
|
|
|
sudo /usr/bin/systemctl stop wg-quick@wg0
|
|
|
|
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
2020-09-11 15:00:39 +00:00
|
|
|
elif [ $res = "Disconnect" ]; then
|
2020-11-23 09:35:26 +00:00
|
|
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
|
|
|
sudo /usr/bin/systemctl stop wg-quick@wg0
|
2020-09-11 15:00:39 +00:00
|
|
|
elif [ $res = "Restart" ]; then
|
2020-11-23 09:35:26 +00:00
|
|
|
if [ "`ip addr show wg0 2> /dev/null`" != "" ]; then
|
|
|
|
sudo /usr/bin/systemctl restart wg-quick@wg0
|
|
|
|
fi
|
|
|
|
if [ "`ip addr show tun0 2> /dev/null`" != "" ]; then
|
|
|
|
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
|
|
|
fi
|
2020-11-16 04:46:04 +00:00
|
|
|
else
|
2020-11-23 09:35:26 +00:00
|
|
|
exit
|
2020-09-11 15:00:39 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Waybar sometimes doesn't update with the VPN IP, for whatever reason. Restart it.
|
|
|
|
# exits above because I change outputs more often than I change VPNs
|
2021-12-31 16:08:28 +00:00
|
|
|
#/home/jpm/scripts/sway/displays.pl -w
|