status

statusbar program for dwm
git clone anongit@rnpnr.xyz:status.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 1c1f1c17d8bef7186d6cab06bcc87042b2fc4762
Parent: 4085b1cd974a755f36533fd4dfc6e392404f590d
Author: Randy Palamar
Date:   Sat,  3 Apr 2021 20:43:32 -0600

only update blocks with an interval

for now this is still fixed at 1 second. the actual interval tracking
code still needs to be written

Diffstat:
Mconfig.def.h | 8++++----
Mstatus.c | 9++++++++-
2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -14,10 +14,10 @@ const char *alsacard = "default"; /* status block definitions */ struct Block blks[] = { /* fn fmt interval signal arg */ - { mpd, "[ %s ", 0, 0, { .i = MPD_TAG_ARTIST } }, - { mpd, "- %s ]", 0, 0, { .i = MPD_TAG_TITLE } }, - { batinfo, "[ %s ]", 0, 0, { .s = "BAT0" } }, - { getvol, "[ %s ]", 0, 0, { .s = "Speaker" } }, + { mpd, "[ %s ", 0, 1, { .i = MPD_TAG_ARTIST } }, + { mpd, "- %s ]", 0, 1, { .i = MPD_TAG_TITLE } }, + { batinfo, "[ %s ]", 30, 0, { .s = "BAT0" } }, + { getvol, "[ %s ]", 0, 2, { .s = "Speaker" } }, { gettime, "[ %R ]", 20, 0, {0} }, { NULL }, }; diff --git a/status.c b/status.c @@ -128,9 +128,16 @@ main(int argc, char *argv[]) if (!dflag && !(dpy = XOpenDisplay(NULL))) die("XOpenDisplay: can't open display\n"); + /* initialize blocks before first print */ + for (b = blks; b->fn; b++) + if (b->interval != -1) + updateblock(b); + updatestatus(); + for (; !done; sleep(1)) for (b = blks; b->fn; b++) { - updateblock(b); + if (b->interval > 0) + updateblock(b); if (dirty) updatestatus(); }