Updated for WireGuard, prevented reloading waybar on abort
This commit is contained in:
parent
c1d609d8a2
commit
7f41003cdc
|
@ -7,23 +7,25 @@ res=$(echo "Connection|John.Me.tz|MailCleaner|Disconnect|Restart" | rofi -sep "|
|
||||||
if [ $res = "Connection" ]; then
|
if [ $res = "Connection" ]; then
|
||||||
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
|
/usr/bin/uxterm -e 'sudo /usr/bin/nmtui'
|
||||||
elif [ $res = "John.Me.tz" ]; then
|
elif [ $res = "John.Me.tz" ]; then
|
||||||
sudo /usr/bin/systemctl stop openvpn-client@*
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
||||||
sudo /usr/bin/systemctl start openvpn-client@john.me.tz
|
sudo /usr/bin/systemctl restart wg-quick@wg0
|
||||||
elif [ $res = "MailCleaner" ]; then
|
elif [ $res = "MailCleaner" ]; then
|
||||||
sudo /usr/bin/systemctl stop openvpn-client@*
|
sudo /usr/bin/systemctl stop wg-quick@wg0
|
||||||
sudo /usr/bin/systemctl start openvpn-client@mailcleaner
|
sudo /usr/bin/systemctl restart openvpn-client@mailcleaner
|
||||||
elif [ $res = "Disconnect" ]; then
|
elif [ $res = "Disconnect" ]; then
|
||||||
sudo /usr/bin/systemctl stop openvpn-client@*
|
sudo /usr/bin/systemctl stop openvpn-client@mailcleaner
|
||||||
|
sudo /usr/bin/systemctl stop wg-quick@wg0
|
||||||
elif [ $res = "Restart" ]; then
|
elif [ $res = "Restart" ]; then
|
||||||
sudo /usr/bin/systemctl restart openvpn-client@*
|
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
|
||||||
|
else
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit
|
|
||||||
|
|
||||||
# Waybar sometimes doesn't update with the VPN IP, for whatever reason. Restart it.
|
# 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
|
# exits above because I change outputs more often than I change VPNs
|
||||||
if [ "$(pgrep -c waybar)" -gt 0 ]; then
|
/home/jpm/scripts/sway/displays.pl -w
|
||||||
sleep 2s
|
|
||||||
pkill waybar
|
|
||||||
waybar
|
|
||||||
fi
|
|
||||||
|
|
Loading…
Reference in New Issue