#!/bin/bash
# Outputs if Express VPN is connected or not

vpnstatus="$(piactl get connectionstate)"

case "$vpnstatus" in
	Disconnected) icon=" " ;;
	Connecting) icon="  " ;;
	Connected) icon=" " ;;
	Interrupted) icon="  " ;;
	Reconnecting) icon="  " ;;
	DisconnectingToReconnect) icon="  ";;
	Disconnecting) icon="  " ;;
esac

# case "$vpnstatus" in
# 	*"Not"*) icon=""
# 		;;
# 	*"Connected"*) icon=""
# 		;;
# 	*"Connecting"*) icon=" "
# 		;;
# 	*) icon=""
# esac

echo " $icon"


# \033]01;31\] # pink
# \033]00m\]   # white
# \033]01;36\] # bold green
# \033]02;36\] # green
# \033]01;34\] # blue
# \033]01;33\] # bold yellow
# s/onnected\sto\s//;
case $BLOCK_BUTTON in
	1) piactl connect && notify-send -a "VPN" "Connected" && kill -36 $(pidof dwmblocks);;
	2) vpnmenu ;;
	3) piactl disconnect && notify-send -a "VPN" "Disonnected" && kill -36 $(pidof dwmblocks);;
	6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac