#!/bin/bash

SERVICE_NAME="wg-quick@wg0"

function status_wireguard() {
  systemctl is-active $SERVICE_NAME >/dev/null 2>&1
  return $?
}

status_wireguard && \
SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl stop $SERVICE_NAME || \
SUDO_ASKPASS=~/.config/waybar/scripts/askpass.sh sudo -A systemctl start $SERVICE_NAME
