all repos — slstatus @ aaf279f6ddfb48146fc1a579efd83a55722910b5

my build of slstatus (tools.suckless.org/slstatus/)

Add a -1 option flag

Allow slstatus to be used by programs that can grab status by calling
an external program on a periodic basis (e.g. tmux)
Daniel Moch daniel@danielmoch.com
Tue, 23 Jun 2020 16:35:43 -0400
commit

aaf279f6ddfb48146fc1a579efd83a55722910b5

parent

d1b23e5509863fd0790261b2b388e687d5218d53

2 files changed, 10 insertions(+), 4 deletions(-)

jump to
M slstatus.1slstatus.1

@@ -1,4 +1,4 @@

-.Dd 2017-08-10 +.Dd 2020-06-23 .Dt SLSTATUS 1 .Os .Sh NAME

@@ -7,6 +7,7 @@ .Nd suckless status monitor

.Sh SYNOPSIS .Nm .Op Fl s +.Op Fl 1 .Sh DESCRIPTION .Nm is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or

@@ -18,6 +19,8 @@ .Sh OPTIONS

.Bl -tag -width Ds .It Fl s Write to stdout instead of WM_NAME. +.It Fl 1 +Write once to stdout and quit. .El .Sh CUSTOMIZATION .Nm
M slstatus.cslstatus.c

@@ -41,7 +41,7 @@

static void usage(void) { - die("usage: %s [-s]", argv0); + die("usage: %s [-s] [-1]", argv0); } int

@@ -56,6 +56,9 @@ const char *res;

sflag = 0; ARGBEGIN { + case '1': + done = 1; + /* fallthrough */ case 's': sflag = 1; break;

@@ -78,7 +81,7 @@ if (!sflag && !(dpy = XOpenDisplay(NULL))) {

die("XOpenDisplay: Failed to open display"); } - while (!done) { + do { if (clock_gettime(CLOCK_MONOTONIC, &start) < 0) { die("clock_gettime:"); }

@@ -125,7 +128,7 @@ die("nanosleep:");

} } } - } + } while (!done); if (!sflag) { XStoreName(dpy, DefaultRootWindow(dpy), NULL);