#!/bin/sh

note()
{
	command -v notify-send > /dev/null &&
		notify-send "󰒒  vpn" "$1"

	printf "\n%s\n" "$1"
}

wg_conf="${1:-kay}"

if systemctl status "wg-quick-${wg_conf}.service" > /dev/null 2>&1; then
	sudo -A systemctl stop "wg-quick-${wg_conf}.service" &&
		note "connection was dropped"
else
	sudo -A systemctl start "wg-quick-${wg_conf}.service" &&
		note "traffic routed through $wg_conf"
fi &&
	command -v wip > /dev/null && wip