mirror of
https://github.com/vale981/bspwm
synced 2025-03-06 02:01:42 -05:00
End status lines by a new line
This commit is contained in:
parent
cb54949f97
commit
40f7a438a6
3 changed files with 6 additions and 3 deletions
6
bspc.c
6
bspc.c
|
@ -29,6 +29,7 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -68,7 +69,10 @@ int main(int argc, char *argv[])
|
||||||
if (nb == 1 && rsp[0] == MESSAGE_FAILURE) {
|
if (nb == 1 && rsp[0] == MESSAGE_FAILURE) {
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
rsp[nb] = '\0';
|
int end = MIN(nb, (int) sizeof(rsp) - 1);
|
||||||
|
rsp[end--] = '\0';
|
||||||
|
while (end >= 0 && isspace(rsp[end]))
|
||||||
|
rsp[end--] = '\0';
|
||||||
printf("%s\n", rsp);
|
printf("%s\n", rsp);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
2
bspwm.c
2
bspwm.c
|
@ -134,8 +134,6 @@ int main(int argc, char *argv[])
|
||||||
msg[n] = '\0';
|
msg[n] = '\0';
|
||||||
if (handle_message(msg, n, rsp)) {
|
if (handle_message(msg, n, rsp)) {
|
||||||
rsp_len = strlen(rsp);
|
rsp_len = strlen(rsp);
|
||||||
if (rsp[rsp_len - 1] == '\n')
|
|
||||||
rsp[--rsp_len] = '\0';
|
|
||||||
} else {
|
} else {
|
||||||
rsp[0] = MESSAGE_FAILURE;
|
rsp[0] = MESSAGE_FAILURE;
|
||||||
rsp_len = 1;
|
rsp_len = 1;
|
||||||
|
|
|
@ -71,6 +71,7 @@ void feed_subscriber(subscriber_list_t *sb)
|
||||||
}
|
}
|
||||||
if (mon != NULL && mon->desk != NULL)
|
if (mon != NULL && mon->desk != NULL)
|
||||||
fprintf(sb->stream, "L%s", (mon->desk->layout == LAYOUT_TILED ? "tiled" : "monocle"));
|
fprintf(sb->stream, "L%s", (mon->desk->layout == LAYOUT_TILED ? "tiled" : "monocle"));
|
||||||
|
fprintf(sb->stream, "%s", "\n");
|
||||||
int ret = fflush(sb->stream);
|
int ret = fflush(sb->stream);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
remove_subscriber(sb);
|
remove_subscriber(sb);
|
||||||
|
|
Loading…
Add table
Reference in a new issue