mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-21 18:05:38 +02:00
module/dwl: correctly handle the title
This commit is contained in:
parent
e4edbd26c6
commit
cd307c4a4c
2 changed files with 19 additions and 6 deletions
|
@ -32,9 +32,11 @@
|
||||||
* Documentation for the `cpu` module; `interval` has been renamed to
|
* Documentation for the `cpu` module; `interval` has been renamed to
|
||||||
`poll-interval` ([#241][241]).
|
`poll-interval` ([#241][241]).
|
||||||
* battery: module was not thread safe.
|
* battery: module was not thread safe.
|
||||||
|
* dwl module reporting only the last part of the title ([#251][251])
|
||||||
|
|
||||||
[239]: https://codeberg.org/dnkl/yambar/issues/239
|
[239]: https://codeberg.org/dnkl/yambar/issues/239
|
||||||
[241]: https://codeberg.org/dnkl/yambar/issues/241
|
[241]: https://codeberg.org/dnkl/yambar/issues/241
|
||||||
|
[251]: https://codeberg.org/dnkl/yambar/pulls/251
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
@ -168,9 +168,12 @@ process_line(char *line, struct module *module)
|
||||||
}
|
}
|
||||||
/* action */
|
/* action */
|
||||||
else if (index == 2) {
|
else if (index == 2) {
|
||||||
if (strcmp(string, "title") == 0)
|
if (strcmp(string, "title") == 0) {
|
||||||
line_mode = LINE_MODE_TITLE;
|
line_mode = LINE_MODE_TITLE;
|
||||||
else if (strcmp(string, "fullscreen") == 0)
|
/* cleanup title for every new batch */
|
||||||
|
free(private->title);
|
||||||
|
private->title = NULL;
|
||||||
|
} else if (strcmp(string, "fullscreen") == 0)
|
||||||
line_mode = LINE_MODE_FULLSCREEN;
|
line_mode = LINE_MODE_FULLSCREEN;
|
||||||
else if (strcmp(string, "floating") == 0)
|
else if (strcmp(string, "floating") == 0)
|
||||||
line_mode = LINE_MODE_FLOATING;
|
line_mode = LINE_MODE_FLOATING;
|
||||||
|
@ -219,12 +222,20 @@ process_line(char *line, struct module *module)
|
||||||
dwl_tag->urgent = mask & urgent;
|
dwl_tag->urgent = mask & urgent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (line_mode == LINE_MODE_TITLE) {
|
||||||
|
if (!private->title) {
|
||||||
|
private->title = strdup(string);
|
||||||
|
} else {
|
||||||
|
char *buf = NULL;
|
||||||
|
if (asprintf(&buf, "%s %s", private->title, string) < 0) {
|
||||||
|
LOG_ERRNO("asprintf");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(private->title);
|
||||||
|
private->title = buf;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
switch (line_mode) {
|
switch (line_mode) {
|
||||||
case LINE_MODE_TITLE:
|
|
||||||
free(private->title);
|
|
||||||
private->title = strdup(string);
|
|
||||||
break;
|
|
||||||
case LINE_MODE_FULLSCREEN:
|
case LINE_MODE_FULLSCREEN:
|
||||||
private->fullscreen = (strcmp(string, "0") != 0);
|
private->fullscreen = (strcmp(string, "0") != 0);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue