#!/bin/bash

SERVICE_NAME="wg-quick@wg0"
STATUS_CONNECTED_STR='{"text":"", "tooltip":"Tunnel connected."}'
STATUS_DISCONNECTED_STR='{"text":"", "tooltip":"Tunnel disconnected"}'

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

status_wireguard && echo $STATUS_CONNECTED_STR || echo $STATUS_DISCONNECTED_STR
