VPN icon for my status bar

What is the formula of VPN switch like 0 and 1? What is the kode to get the VPN status?

This is the code I use;

$if(sh(ip addr show tun0)~="does not exist.", "0", "1")$

However, some devices persist the tun0 interface between reboots, so may not work for all.

Thanks! It work! I have to put VPN icon on my status bar. Well you said that may not work for all, i know that my other devices should bot work i think. You try this formula and since reboot, it’s not working?