From b99308b026e7e4389ef1e21420316bf14bdcf651 Mon Sep 17 00:00:00 2001 From: Jason Nader Date: Sat, 14 Mar 2020 12:41:54 +0900 Subject: [PATCH] swaybar: only display the last status line --- swaybar/status_line.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/swaybar/status_line.c b/swaybar/status_line.c index fb9271f82..249a6aad2 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -113,6 +113,11 @@ bool status_handle_readable(struct status_line *status) { sway_log(SWAY_DEBUG, "Using text protocol."); status->protocol = PROTOCOL_TEXT; + char *last_newline = strrchr(status->buffer, '\n'); + if (last_newline != NULL) { + status->buffer_index = strlen(last_newline + 1); + memmove(status->buffer, last_newline + 1, status->buffer_index + 1); + } status->text = status->buffer; // intentional fall-through case PROTOCOL_TEXT: