From e4b38bac467d969e92a0e9609ea6f5761ce1b66e Mon Sep 17 00:00:00 2001 From: ivan-boikov Date: Sun, 22 Dec 2024 15:59:17 +0100 Subject: VPN path --- components/vpn.c | 14 ++++++-------- config.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/components/vpn.c b/components/vpn.c index e5439fb..4d230e1 100644 --- a/components/vpn.c +++ b/components/vpn.c @@ -1,18 +1,16 @@ /* See LICENSE file for copyright and license details. */ #include -#include -#include +#include #include "../slstatus.h" #include "../util.h" const char * -vpn_status(const char *unused) +vpn_status(const char *path) { - char state[32]; - - if (pscanf("/sys/class/net/tun0/operstate", "%s", state) != 1) + if (access(path, F_OK) == 0) { + return bprintf(""); + } else { return bprintf(""); - - return bprintf(""); + } } diff --git a/config.h b/config.h index c8b32a1..e00f102 100644 --- a/config.h +++ b/config.h @@ -69,7 +69,7 @@ static const struct arg args[] = { { cat, "[%3s%%]", "$XDG_RUNTIME_DIR/volume" }, // BATSTATE // NETSPEED - { vpn_status, "%s", NULL }, + { vpn_status, "%s", "/sys/class/net/tun0/operstate" }, { cpu_perc, "[%3s%%  ", NULL }, { cpu_freq, "%s]", NULL }, { ram_used, "[%s/", NULL }, -- cgit v1.2.3