From ad0d1350fdf058dfd718192611f1f4320148d2ca Mon Sep 17 00:00:00 2001 From: AtomToast Date: Wed, 29 May 2024 17:48:21 +0200 Subject: [PATCH 1/3] feat(river/layout): add format-icons --- man/waybar-river-layout.5.scd | 35 +++++++++++++++++++++++++++++++---- src/modules/river/layout.cpp | 4 +++- 2 files changed, 34 insertions(+), 5 deletions(-) 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(); } From bcac5ffc23897b1d988b9b05e53924944698bb04 Mon Sep 17 00:00:00 2001 From: AtomToast Date: Wed, 29 May 2024 17:48:54 +0200 Subject: [PATCH 2/3] doc(README): update river feature list --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5266e916..2cc8bff4 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) - DWL (Tags, Focused window name) [requires dwl ipc patch](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/ipc) From b4c247a4372cfc4fad1f8524284785d9178163ad Mon Sep 17 00:00:00 2001 From: AtomToast Date: Tue, 29 Apr 2025 17:26:17 +0200 Subject: [PATCH 3/3] remove unused variable --- src/modules/river/layout.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/river/layout.cpp b/src/modules/river/layout.cpp index 589ca29f..8109dadc 100644 --- a/src/modules/river/layout.cpp +++ b/src/modules/river/layout.cpp @@ -146,7 +146,6 @@ void Layout::handle_name(const char *name) { label_.hide(); // hide empty labels or labels with empty format } else { label_.show(); - 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)))); }