diff --git a/components/wg.sh b/components/wg.sh new file mode 100644 index 0000000..d84caf2 --- /dev/null +++ b/components/wg.sh @@ -0,0 +1,10 @@ +response=$(curl -s https://am.i.mullvad.net/json) +if [ $? -ne 0 ]; then + exit 1 +fi +server=$(echo "$response" | jq -r '.mullvad_exit_ip_hostname') +if [ "$server" != "null" ]; then + echo "$server" +else + echo "NULL" +fi diff --git a/config.def.h b/config.def.h index d80cf71..93c0736 100755 --- a/config.def.h +++ b/config.def.h @@ -10,6 +10,7 @@ static const struct arg args[] = { { netspeed_rx, " [ %sB/s]", IFACE }, { netspeed_tx, " [ %sB/s]", IFACE }, { ipv4, " ^c#fb4934^[ %s]", IFACE }, + { run_command, " ^c#fb4934^[%s]", "sh /opt/suckless/slstatus/components/wg.sh" }, //{ mullvad_stat, " [VPN: %s]", NULL}, //{ battery_perc, " ^c#fe9019^[ %s%%", BAT },