From f7a2fe9a50fc6de655c7b59400a0eaff98b79c5f Mon Sep 17 00:00:00 2001 From: sebastien peterson boudreau <sebastien.peterson.boudreau@gmail.com> Date: Sat, 10 Aug 2024 09:06:59 -0300 Subject: [PATCH] Move CMDLENGTH to blocks.h so it can be user configured --- blocks.def.h | 3 +++ dwmblocks.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/blocks.def.h b/blocks.def.h index dbb33054..dda84c0e 100644 --- a/blocks.def.h +++ b/blocks.def.h @@ -9,3 +9,6 @@ static const Block blocks[] = { //sets delimiter between status commands. NULL character ('\0') means no delimiter. static char delim[] = " | "; static unsigned int delimLen = 5; + +/* Maximum length of status text */ +#define CMDLENGTH 50 diff --git a/dwmblocks.c b/dwmblocks.c index befd252d..3fde45dc 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -14,9 +14,7 @@ #define SIGMINUS SIGRTMIN #endif #define LENGTH(X) (sizeof(X) / sizeof (X[0])) -#define CMDLENGTH 50 #define MIN( a, b ) ( ( a < b) ? a : b ) -#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1) typedef struct { char* icon; @@ -49,6 +47,7 @@ static void (*writestatus) () = pstdout; #include "blocks.h" +#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1) static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0}; static char statusstr[2][STATUSLENGTH];