#!/bin/sh

STATUS=`ivpn status | awk '{print "\\\n"$0}' | head -n -1`
TOOLTIP=`echo -E ${STATUS} | cut -c 3-`
CLASS=`echo ${STATUS} | grep 'VPN' | awk '{print $3}' | tr [:upper:] [:lower:]`
TEXT=""

if [ "$CLASS" == "connected" ]; then
    TEXT="\uf084" # key
else
    TEXT="\uf071" # exclamation-triangle
fi

echo "{\"text\": \"${TEXT}\", \"tooltip\": \"${TOOLTIP}\", \"class\": \"${CLASS}\"}"
