diff --git a/man/waybar-river-layout.5.scd b/man/waybar-river-layout.5.scd index 78e03634..7f4ff2e5 100644 --- a/man/waybar-river-layout.5.scd +++ b/man/waybar-river-layout.5.scd @@ -16,9 +16,13 @@ Addressed by *river/layout* *format*: ++ typeof: string ++ - default: {} ++ + default: {layout} ++ The format, how information should be displayed. On {} data gets inserted. +*format-icons*: ++ + typeof: array ++ + Based on the current layout, the corresponding icon gets selected. + *rotate*: ++ typeof: integer ++ Positive value to rotate the text label (in 90 degree increments). @@ -69,16 +73,39 @@ Addressed by *river/layout* default: false ++ Enables this module to consume all left over space dynamically. -# EXAMPLE +# FORMAT REPLACEMENTS + +*{layout}*: Layout, as defined by your layout generator. By default this will be *rivertile(1)* + +*{icon}*: Icon, as defined in *format-icons* + +# EXAMPLES + +With layout name: ``` "river/layout": { - "format": "{}", + "format": "{layout}", "min-length": 4, "align": "right" } ``` +With icons, this sets icons for the 4 layouts available in rivertile: + +``` +"river/layout": { + "format": "{icon}", + "min-length": 3, + "format-icons": { + "left": "[]=", + "bottom": "TTT", + "top": "ꓕꓕꓕ", + "right": "=[]", + } +} +``` + # STYLE - *#layout* @@ -86,4 +113,4 @@ Addressed by *river/layout* # SEE ALSO -waybar(5), river(1) +waybar(5), river(1), rivertile(1) diff --git a/src/modules/river/layout.cpp b/src/modules/river/layout.cpp index e938400f..589ca29f 100644 --- a/src/modules/river/layout.cpp +++ b/src/modules/river/layout.cpp @@ -146,7 +146,9 @@ void Layout::handle_name(const char *name) { label_.hide(); // hide empty labels or labels with empty format } else { label_.show(); - label_.set_markup(fmt::format(fmt::runtime(format_), Glib::Markup::escape_text(name).raw())); + std::string escaped_name=Glib::Markup::escape_text(name).raw(); + label_.set_markup(fmt::format(fmt::runtime(format_), fmt::arg("layout", name), + fmt::arg("icon", getIcon(0, name)))); } ALabel::update(); }