last_status=1; while true; do timestamp=$(date +"%Y-%m-%d %H:%M:%S"); if ping -c 1 -W 5 8.8.8.8 > /dev/null 2>&1; then status=0; else status=1; fi; if [ "$status" -ne "$last_status" ]; then if [ "$status" -eq 1 ]; then notify-send "Internet Lost" "Internet lost at $timestamp"; echo "$timestamp Internet Lost."; else notify-send "Internet Restored" "Internet restored at $timestamp"; echo "$timestamp Internet Restored."; fi; last_status=$status; fi; sleep 3; done
Install Generic Monitor sudo apt-get install xfce4-genmon-plugin
Add GenMon to the panel, uncheck Label
then add this setup script
sh -c 'ip a | grep -q "tun0" && ip -4 addr show tun0 | awk "/inet/ {print \$2}" | cut -d/ -f1 || curl -s ifconfig.me'