diff options
Diffstat (limited to 'dotfiles/.local/bin/togglevpn')
-rwxr-xr-x | dotfiles/.local/bin/togglevpn | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/togglevpn b/dotfiles/.local/bin/togglevpn new file mode 100755 index 0000000..f1a6bdb --- /dev/null +++ b/dotfiles/.local/bin/togglevpn @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -f "$HOME/.cache/openvpnpid" ]; then + sudo killall -SIGINT openvpn + exit +fi + +sudo openvpn "$HOME/.config/ovpn/conf.ovpn" & +PID=$! +notify-send "🔐 OpenVPN" "VPN is being initialized" +echo $PID > ~/.cache/openvpnpid +killall -40 waybar +wait $PID +notify-send "🔐 OpenVPN" "VPN service has stopped with exit code $?" +rm ~/.cache/openvpnpid +killall -40 waybar |