Skip to content

group: allow replacing the drawer leader when expanded - #5291

Open
bjnobre wants to merge 2 commits into
Alexays:masterfrom
bjnobre:feature/drawer-hide-leader
Open

group: allow replacing the drawer leader when expanded#5291
bjnobre wants to merge 2 commits into
Alexays:masterfrom
bjnobre:feature/drawer-hide-leader

Conversation

@bjnobre

@bjnobre bjnobre commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

This change adds the hide-leader-when-expanded option to drawer groups.

It allows the first module to serve as a compact representation of the drawer's contents. When the drawer expands, the leader is hidden and replaced by the child modules. When the drawer collapses, the leader becomes visible again.

My use case is a media group composed of:

  • A ten-bar CAVA audio visualizer shown while the drawer is collapsed.
  • Four media controls.
  • Controls that occupy approximately the same horizontal space as the visualizer.

The configuration looks like this:

"group/cava-media": {
    "orientation": "inherit",
    "drawer": {
        "transition-duration": 180,
        "transition-left-to-right": false,
        "hide-leader-when-expanded": true,
        "children-class": "cava-media-control"
    },
    "modules": [
        "custom/cava",
        "custom/media-previous",
        "custom/media-stop",
        "custom/media-play-pause",
        "custom/media-next"
    ]
}

While collapsed, the group displays only the CAVA visualizer:

⡀⣀⣄⣤⣦⣶⣷⣿⣶⣄

When the pointer enters the group, the visualizer is replaced by the media controls:

󰒮  󰓛  󰐎  󰒭

Without this option, a drawer keeps its first module visible and reveals its children beside it. That is appropriate when the first module is a permanent button or indicator, but it does not support cases where the expanded content is intended to be an alternative view of the same space.

The option defaults to false, so existing configurations retain their current behavior.

The second commit fixes tooltip behavior during this replacement. Hiding the leader changes the widget under a stationary pointer. GTK does not always initiate another tooltip query in that situation, so a newly revealed child's tooltip may not appear until the pointer leaves and enters the group again.

To address this, the group triggers a tooltip query once the drawer's reveal transition has completed. This allows the revealed widget to display its tooltip without repeatedly querying during the animation.

I tested horizontal drawers in both transition directions. When hide-leader-when-expanded is not configured, existing drawer behavior remains unchanged.

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