From b900c01381d4442e7ebf2fda551ff0934900e97d Mon Sep 17 00:00:00 2001 From: trevnels <25140503+trevnels@users.noreply.github.com> Date: Thu, 19 May 2022 15:32:10 -0400 Subject: [PATCH] add manpage and make format option work --- man/waybar-river-window.5.scd | 31 +++++++++++++++++++++++++++++++ src/modules/river/window.cpp | 9 +++------ 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 man/waybar-river-window.5.scd diff --git a/man/waybar-river-window.5.scd b/man/waybar-river-window.5.scd new file mode 100644 index 0000000..4740a5b --- /dev/null +++ b/man/waybar-river-window.5.scd @@ -0,0 +1,31 @@ +waybar-river-window(5) + +# NAME + +waybar - river window module + +# DESCRIPTION + +The *window* module displays the title of the currently focused window in river + +# CONFIGURATION + +Addressed by *river/window* + +*format*: ++ + typeof: string ++ + default: {} ++ + The format, how information should be displayed. On {} data gets inserted. + +# EXAMPLES + +``` +"river/window": { + "format": "{}" +} +``` + +# STYLE + +- *#window* +- *window#.focused* Applied when the output this module's bar belongs to is focused. \ No newline at end of file diff --git a/src/modules/river/window.cpp b/src/modules/river/window.cpp index b40fdfc..18799f3 100644 --- a/src/modules/river/window.cpp +++ b/src/modules/river/window.cpp @@ -1,14 +1,11 @@ #include "modules/river/window.hpp" -#include -#include #include #include #include #include "client.hpp" -#include "xdg-output-unstable-v1-client-protocol.h" namespace waybar::modules::river { @@ -99,11 +96,11 @@ void Window::handle_focused_view(const char *title) { // last focused view, and will get blank labels until they are brought into focus at least once. if (focused_output_ != output_) return; - if (std::strcmp(title, "") == 0) { - label_.hide(); // hide empty labels + if (std::strcmp(title, "") == 0 || format_.empty()) { + label_.hide(); // hide empty labels or labels with empty format } else { label_.show(); - label_.set_markup(title); + label_.set_markup(fmt::format(format_, title)); } ALabel::update();