summaryrefslogtreecommitdiff
path: root/dwmblocks.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-06-02 15:46:11 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-06-02 15:46:11 -0400
commitd3eed011269519dca2364e480bf32105b1dfd0d9 (patch)
treecdcf0cada45f61764313c47b936c0131e9b6af34 /dwmblocks.c
parentda7df2f2c263d5534f7b43ea9b0eda01e0986a17 (diff)
parentc35edaad213371d46b6a768be342affb435ab964 (diff)
downloaddwmblocks-d3eed011269519dca2364e480bf32105b1dfd0d9.tar.gz
dwmblocks-d3eed011269519dca2364e480bf32105b1dfd0d9.tar.bz2
dwmblocks-d3eed011269519dca2364e480bf32105b1dfd0d9.zip
Merge branch 'master' of github.com:LukeSmithxyz/dwmblocks
Diffstat (limited to 'dwmblocks.c')
-rw-r--r--dwmblocks.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dwmblocks.c b/dwmblocks.c
index f061503..d135a7d 100644
--- a/dwmblocks.c
+++ b/dwmblocks.c
@@ -75,11 +75,12 @@ void getcmd(const Block *block, char *output)
return;
char c;
int i = strlen(block->icon);
- fgets(output+i, CMDLENGTH-i, cmdf);
+ fgets(output+i, CMDLENGTH-(strlen(delim)+1), cmdf);
remove_all(output, '\n');
i = strlen(output);
- if (delim != '\0' && i)
- output[i++] = delim;
+ if ((i > 0 && block != &blocks[LENGTH(blocks) - 1]))
+ strcat(output, delim);
+ i+=strlen(delim);
output[i++] = '\0';
pclose(cmdf);
}
@@ -134,8 +135,11 @@ int getstatus(char *str, char *last)
{
strcpy(last, str);
str[0] = '\0';
- for(int i = 0; i < LENGTH(blocks); i++)
+ for(int i = 0; i < LENGTH(blocks); i++) {
strcat(str, statusbar[i]);
+ if (i == LENGTH(blocks) - 1)
+ strcat(str, " ");
+ }
str[strlen(str)-1] = '\0';
return strcmp(str, last);//0 if they are the same
}
@@ -222,7 +226,7 @@ int main(int argc, char** argv)
for(int i = 0; i < argc; i++)
{
if (!strcmp("-d",argv[i]))
- delim = argv[++i][0];
+ delim = argv[++i];
else if(!strcmp("-p",argv[i]))
writestatus = pstdout;
}
Software created with 💖