From f1db607cacce2d2d144c2f813678286ab4b3572d Mon Sep 17 00:00:00 2001 From: meml0rz Date: Fri, 1 Nov 2024 03:36:47 +0100 Subject: [PATCH] add wg.sh --- components/wg.sh | 10 ++++++++++ config.def.h | 1 + 2 files changed, 11 insertions(+) create mode 100644 components/wg.sh 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 },