#!/bin/sh

while true
do
    vpn="disconnected"
    if ip link ls tun0 > /dev/null 2>&1; then
        vpn="connected"
    fi
    wifi="disconnected (0%)"
    if nmcli dev show wlp0s20f3 | grep GENERAL.STATE | grep -q connected; then
        wifiname="$(nmcli -t dev show wlp0s20f3 | grep GENERAL.CONNECTION | cut -d ':' -f 2)"
        wifistrength="$(nmcli dev show wlp0s20f3 | awk '/GENERAL.STATE/ {print $2}')"
        wifi="$wifiname ($wifistrength%)"
    fi
    battery="$(cat /sys/class/power_supply/BAT0/capacity)%"
    time=$(date +"%A %Y-%m-%d %I:%M %p")
    est_time=$(TZ=America/New_York date +"(🗽%I:%M ET)")
    time="$time $est_time $(date -u +"(🤖%H:%M UTC)")"
    # --date='TZ="America/New_York"
    printf "%s | %s | %s\n" "💓 ${wifi} (vpn $vpn)" "🥤 ${battery}" "${time}"
    sleep 10
done
