commit 034595f49115efbea65897c50f15ed2ee7b8bcfb
parent 9391c77c509fb3ed37b00c3d59e52c046b473c37
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Sun, 28 Mar 2021 22:25:31 +0200

Remove block icons

Diffstat:
Mconfig.def.h | 6+++---
Mdwmblocks.c | 7+++----
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,9 +1,9 @@ /* modify this file to change what commands output to your statusbar, and * recompile using the make command */ static const Block blocks[] = { - /* icon command interval signal */ - {"Mem:","free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0}, - {"", "date '+%b %d (%a) %I:%M%p'", 5, 0}, + /* command interval signal */ + {"free -h | awk '/^Mem/ { print \"Mem: \"$3\"/\"$2 }' | sed s/i//g", 30, 0}, + {"date '+%b %d (%a) %I:%M%p'", 5, 0}, }; /* sets delimeter between status commands. NULL character ('\0') means no diff --git a/dwmblocks.c b/dwmblocks.c @@ -19,7 +19,6 @@ #define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1) typedef struct { - char* icon; char* command; unsigned int interval; unsigned int signal; @@ -57,13 +56,13 @@ static int returnStatus = 0; /* opens process *cmd and stores output in *output */ void getcmd(const Block *block, char *output) { - strcpy(output, block->icon); + int i; FILE *cmdf = popen(block->command, "r"); if (!cmdf) return; - int i = strlen(block->icon); - fgets(output+i, CMDLENGTH-i-strlen(delim), cmdf); + fgets(output, CMDLENGTH-strlen(delim), cmdf); pclose(cmdf); + i = strlen(output); i = (i && output[i-1] == '\n') ? i-1 : i; /* delete trailing newline */ if (i == 0) /* ensure length 0 in case the string was "\n" */