Skip to content

feat(group): Add .empty class to empty groups#4941

Open
sjudin wants to merge 2 commits intoAlexays:masterfrom
sjudin:groups-add-empty-css-class
Open

feat(group): Add .empty class to empty groups#4941
sjudin wants to merge 2 commits intoAlexays:masterfrom
sjudin:groups-add-empty-css-class

Conversation

@sjudin
Copy link
Copy Markdown
Contributor

@sjudin sjudin commented Mar 20, 2026

Description:
Add .empty class to groups if they contain no modules

The use-case for this is when having groups that contain things related to battery/backlight which is not available on a desktop, in that case it would be nice to be able to detect that the group is empty and hide it.

Also add configuration empty-if-drawer-empty parameter to control if a drawer should count as empty if only the "main" module could be loaded, this is useful if you have an icon or something similar which always loads and you want to hide the group when drawer children were not able to.

If all drawer children are hidden or missing, the group dynamically receives the .empty CSS class.

This is completely event-driven using GTK signals (property_visible().signal_changed()) hooked into Group::update().

Because Waybar shouldn't enforce hiding policies natively, this simply applies the class, leaving it up to the user to define how the .empty group should behave in their style.css.

/* Example provided in the man page to completely hide the group */
#<group>.empty,
#<group>.empty * {
    min-width: 0px;
    min-height: 0px;
    padding: 0px;
    margin: 0px;
    border: none;
    font-size: 0px;
    opacity: 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant