1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00
dotfiles/wireguard/.local/bin/wireguard-switch

20 lines
455 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2020-03-11 22:46:34 +00:00
###
# Switch wireguard vpns up/down
###
STATUS="$(nmcli device status | grep -c $1)"
2020-03-11 22:46:34 +00:00
case $STATUS in
1)
wg-quick down "$1"
notify-send.py -a wireguard --replaces-process wireguard-status-"$1" -i network-vpn-offline-symbolic "Wireguard $1" "Connection down" &
2020-03-11 22:46:34 +00:00
;;
*)
wg-quick up "$1"
notify-send.py -a wireguard --replaces-process wireguard-status-"$1" -i network-vpn-symbolic "Wireguard $1" "Connection up" &
2020-03-11 22:46:34 +00:00
;;
esac