aboutsummaryrefslogtreecommitdiff
path: root/dwmblocks.c
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-05-30 08:38:33 -0400
committerGitHub <noreply@github.com>2020-05-30 08:38:33 -0400
commit9a7ecafdcccfb5ab874a1ef9389fed600cac8050 (patch)
tree75c37a268806fc871f3281f1bdc9d4293d592d03 /dwmblocks.c
parent6d75ac1b00482e842f3e600cddde3b31a1c35ede (diff)
parente2ca6028d61859b66816fadeb6103fee1fa58314 (diff)
downloaddwmblocks-9a7ecafdcccfb5ab874a1ef9389fed600cac8050.tar.gz
dwmblocks-9a7ecafdcccfb5ab874a1ef9389fed600cac8050.tar.bz2
dwmblocks-9a7ecafdcccfb5ab874a1ef9389fed600cac8050.zip
Merge pull request #28 from mackarelfish/master
Fixed weird blocks behaviour with moving text (music, nettraf), Added support for multiple char delimiter
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 bf648c2..391ee0d 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);
}
@@ -130,8 +131,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
}
@@ -218,7 +222,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;
}