#!/bin/bash

declare -A vpn_data
nm_active=`nmcli con show --active`

if echo "${nm_active}" | grep -q 'vpn';then
  vpn_data["text"]=''
  vpn_data["tooltip"]='VPN Up'
  vpn_data["class"]='["connected"]'
  vpn_data["alt"]='connected'
else
  vpn_data["text"]=''
  vpn_data["tooltip"]='VPN Down'
  vpn_data["class"]='["disconnected"]'
  vpn_data["alt"]='disconnected'
fi

printf '{"text":"%s","tooltip":"%s","class":%s,"alt":"%s"}' "${vpn_data[text]}" "${vpn_data[tooltip]}" "${vpn_data[class]}" "${vpn_data[alt]}"
