diff --git a/blocks.def.h b/blocks.def.h index 9c22d68b..b0454f87 100644 --- a/blocks.def.h +++ b/blocks.def.h @@ -9,3 +9,7 @@ static const Block blocks[] = { //sets delimeter between status commands. NULL character ('\0') means no delimeter. static char delim[] = " | "; static unsigned int delimLen = 5; + +// Sets delimiters around the full statusbar. NULL character ('\0') means no delimeter. +static char leftpad[] = " "; +static char rightpad[] = " "; diff --git a/dwmblocks.c b/dwmblocks.c index ded717c1..45fc66ac 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -16,7 +16,8 @@ #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) +#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1 + \ + LENGTH(leftpad) + LENGTH(rightpad)) typedef struct { char* icon; @@ -119,9 +120,13 @@ int getstatus(char *str, char *last) { strcpy(last, str); str[0] = '\0'; + if (leftpad[0] != '\0') + strcat(str, leftpad); for (unsigned int i = 0; i < LENGTH(blocks); i++) strcat(str, statusbar[i]); str[strlen(str)-strlen(delim)] = '\0'; + if (rightpad[0] != '\0') + strcat(str, rightpad); return strcmp(str, last);//0 if they are the same }