Skip to content

feat(river): set layout name as class #4080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/modules/river/layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Layout : public waybar::ALabel {

private:
const waybar::Bar &bar_;
std::string name_;
struct wl_output *output_; // stores the output this module belongs to
struct wl_output *focused_output_; // stores the currently focused output
struct zriver_output_status_v1 *output_status_;
Expand Down
1 change: 1 addition & 0 deletions man/waybar-river-layout.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Addressed by *river/layout*

- *#layout*
- *#layout.focused* Applied when the output this module's bar belongs to is focused.
- *#layout.<layout>* Applied when the output this module's bar belongs uses this layout.

# SEE ALSO

Expand Down
9 changes: 8 additions & 1 deletion src/modules/river/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,16 @@ void Layout::handle_name(const char *name) {
if (std::strcmp(name, "") == 0 || format_.empty()) {
label_.hide(); // hide empty labels or labels with empty format
} else {
label_.show();
if (!name_.empty()) {
label_.get_style_context()->remove_class(name_);
}

label_.get_style_context()->add_class(name);
label_.set_markup(fmt::format(fmt::runtime(format_), Glib::Markup::escape_text(name).raw()));
label_.show();

}
name_ = name;
ALabel::update();
}

Expand Down