Allow slstatus to be used by programs that can grab status by calling
an external program on a periodic basis (e.g. tmux)
-.Dd 2017-08-10
+.Dd 2020-06-23
.Dt SLSTATUS 1
.Os
.Sh NAME
.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
.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
static void
usage(void)
{
- die("usage: %s [-s]", argv0);
+ die("usage: %s [-s] [-1]", argv0);
}
int
sflag = 0;
ARGBEGIN {
+ case '1':
+ done = 1;
+ /* fallthrough */
case 's':
sflag = 1;
break;
die("XOpenDisplay: Failed to open display");
}
- while (!done) {
+ do {
if (clock_gettime(CLOCK_MONOTONIC, &start) < 0) {
die("clock_gettime:");
}
}
}
}
- }
+ } while (!done);
if (!sflag) {
XStoreName(dpy, DefaultRootWindow(dpy), NULL);