Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions blocks.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = " ";
7 changes: 6 additions & 1 deletion dwmblocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}

Expand Down