commit 95747b1a8ef7e093b7c9fcf51e4e4796316ab811
parent 7302b5557330db1eecb8b0bb06d175aa45445f25
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date: Sun, 28 Mar 2021 22:25:31 +0200
Remove block icons
Diffstat:
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" */