diff --git a/README.md b/README.md index 687f8234..c92f842b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ #### Current features - Sway (Workspaces, Binding mode, Focused window name) -- River (Mapping mode, Tags, Focused window name) +- River (Mapping mode, Tags, Focused window name, Layout) - Hyprland (Window Icons, Workspaces, Focused window name) - Niri (Workspaces, Focused window name, Language) - Mango (Workspaces, Focused window name, Language, Keymode) diff --git a/man/waybar-river-layout.5.scd b/man/waybar-river-layout.5.scd index a259b9ca..e3540217 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* @@ -87,4 +114,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 3f1745fe..e838800c 100644 --- a/src/modules/river/layout.cpp +++ b/src/modules/river/layout.cpp @@ -151,7 +151,9 @@ void Layout::handle_name(const char* name) { } label_.get_style_context()->add_class(name); - label_.set_markup(fmt::format(fmt::runtime(format_), Glib::Markup::escape_text(name).raw())); + label_.set_markup(fmt::format(fmt::runtime(format_), + fmt::arg("layout", Glib::Markup::escape_text(name).raw()), + fmt::arg("icon", getIcon(0, name)))); label_.show(); } name_ = name;