wmsl

Block-based window manager status line
git clone https://git.sinitax.com/sinitax/wmsl
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 2b85fd14f3f4f38c4e90bd53a60fbe8e17a7be7e
parent a1fd6304d6ad27c65ccb914be65763287c387089
Author: Louis Burda <quent.burda@gmail.com>
Date:   Tue, 29 Sep 2020 12:00:03 +0200

Add prefix and suffix patch

Diffstat:
Acontrib/prefix-suffix.diff | 24++++++++++++++++++++++++
Mwmsl.c | 5+++++
2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/contrib/prefix-suffix.diff b/contrib/prefix-suffix.diff @@ -0,0 +1,24 @@ +diff --git a/wmsl.c b/wmsl.c +index 8f0d0fd..c2ec6e6 100644 +--- a/wmsl.c ++++ b/wmsl.c +@@ -22,6 +22,7 @@ struct block { + const char *command; + unsigned int id, sleep_max; + int flags; ++ const char *prefix, *suffix; + float sleep_left; + char output[OUTPUTMAX]; + }; +@@ -135,7 +136,11 @@ update_blocks() + if (output_len) { + if (status_len > 0) + concat_status(delim, ARRSIZE(delim) - 1); ++ if (blocks[i].prefix) ++ concat_status(blocks[i].prefix, strlen(blocks[i].prefix)); + concat_status(blocks[i].output, output_len); ++ if (blocks[i].suffix) ++ concat_status(blocks[i].suffix, strlen(blocks[i].suffix)); + } + } + if (!update) return; diff --git a/wmsl.c b/wmsl.c @@ -22,6 +22,7 @@ struct block { const char *command; unsigned int id, sleep_max; int flags; + const char *prefix, *suffix; float sleep_left; char output[OUTPUTMAX]; }; @@ -135,7 +136,11 @@ update_blocks() if (output_len) { if (status_len > 0) concat_status(delim, ARRSIZE(delim) - 1); + if (blocks[i].prefix) + concat_status(blocks[i].prefix, strlen(blocks[i].prefix)); concat_status(blocks[i].output, output_len); + if (blocks[i].suffix) + concat_status(blocks[i].suffix, strlen(blocks[i].suffix)); } } if (!update) return;