Merge pull request #3311 from AtomToast/master

add format-icons to river/layout
This commit is contained in:
Alexis Rouillard
2026-07-04 01:09:58 +02:00
committed by GitHub
3 changed files with 35 additions and 6 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
#### Current features #### Current features
- Sway (Workspaces, Binding mode, Focused window name) - 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) - Hyprland (Window Icons, Workspaces, Focused window name)
- Niri (Workspaces, Focused window name, Language) - Niri (Workspaces, Focused window name, Language)
- Mango (Workspaces, Focused window name, Language, Keymode) - Mango (Workspaces, Focused window name, Language, Keymode)
+31 -4
View File
@@ -16,9 +16,13 @@ Addressed by *river/layout*
*format*: ++ *format*: ++
typeof: string ++ typeof: string ++
default: {} ++ default: {layout} ++
The format, how information should be displayed. On {} data gets inserted. 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*: ++ *rotate*: ++
typeof: integer ++ typeof: integer ++
Positive value to rotate the text label (in 90 degree increments). Positive value to rotate the text label (in 90 degree increments).
@@ -69,16 +73,39 @@ Addressed by *river/layout*
default: false ++ default: false ++
Enables this module to consume all left over space dynamically. 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": { "river/layout": {
"format": "{}", "format": "{layout}",
"min-length": 4, "min-length": 4,
"align": "right" "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 # STYLE
- *#layout* - *#layout*
@@ -87,4 +114,4 @@ Addressed by *river/layout*
# SEE ALSO # SEE ALSO
waybar(5), river(1) waybar(5), river(1), rivertile(1)
+3 -1
View File
@@ -151,7 +151,9 @@ void Layout::handle_name(const char* name) {
} }
label_.get_style_context()->add_class(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(); label_.show();
} }
name_ = name; name_ = name;