slstatus

My fork of https://tools.suckless.org/slstatus/
git clone https://git.inz.fi/slstatus
Log | Files | Refs | README | LICENSE

commit 376f9191ee9db202963237d9b994f3131cb9a0c9
parent 641b8671c652d4d628ad83999d84962f22390993
Author: Santtu Lakkala <inz@inz.fi>
Date:   Wed, 23 Feb 2022 08:53:34 +0200

Allow modules to have no output

Instead of using a default value when modules return NULL, skip them
completely.

Diffstat:
Mconfig.def.h | 9++++++---
Mslstatus.c | 2+-
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -3,9 +3,6 @@ /* interval between updates (in ms) */ const unsigned int interval = 1000; -/* text to show if no value can be retrieved */ -static const char unknown_str[] = "n/a"; - /* maximum output string length */ #define MAXLEN 2048 @@ -62,6 +59,12 @@ static const char unknown_str[] = "n/a"; * NULL on OpenBSD * wifi_perc WiFi signal in percent interface name (wlan0) * wifi_essid WiFi ESSID interface name (wlan0) + * + * wintitle Selected part of a window title comma separated list of + * strings that must be + * present in the window + * title, with ! indicating + * the part to capture */ static const struct arg args[] = { /* function format argument */ diff --git a/slstatus.c b/slstatus.c @@ -89,7 +89,7 @@ main(int argc, char *argv[]) status[0] = '\0'; for (i = len = 0; i < LEN(args); i++) { if (!(res = args[i].func(args[i].args))) { - res = unknown_str; + continue; } if ((ret = esnprintf(status + len, sizeof(status) - len, args[i].fmt, res)) < 0) {