Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.52k stars 704 forks source link

on-click and hover doesn't work on the group itself #3174

Closed itcreeperboy closed 5 months ago

itcreeperboy commented 5 months ago

i have a group of modules and i wanted clicking any part of the group to send me to missioncenter

"group/hardware": {
        "on-click": "missioncenter",
        "orientation": "horizontal",
        "modules": [
            "disk",
            "memory",
            "cpu",
            "custom/gpu"
        ]
    }

i tried just doing this but it didn't trigger when i clicked.

not a big deal because i can just do on-click on the individual modules

but then i tried to add a border to the group on hover:

#hardware:hover {
  box-shadow: inset 0 0 0 4px #cba6f7;
}

and it doesn't trigger when i hover over it, unlike any normal module or the seperate modules in the group when i do this:

#hardware *:hover {
  box-shadow: inset 0 0 0 4px #cba6f7;
} 

and i havn't found a way to trigger adding a border to the whole group from hovering on one of it's modules

idk if this is intended or not, if it is, is there some other way to get the same result? sorry if i'm being stupid i'm css noob lol

here is config and style.css

ordy commented 5 months ago

Your selector for that group should be #hardware-group not just #hardware

However, the group should be a GtkBox and I don't know if they support box-shadow, while simple borders should work

#hardware-group: { border: 4px solid #cba6f7 } 

That would obviously add an extra 4px padding to your group (probably what you are trying to avoid using the box-shadow).

Now for the hover part, I couldn't make it work on the group selector, but note that hover for custom modules has been implemented just a week ago in #3145 so there is a chance that the group module has been left out.

#hardware-group label:hover works but that's just on the label part, not over the modules.

if you set #hardware-group box you have the border on the modules, but again, no hover support straight on box:hover.

If you need help targeting your css classes, run warbar with the GTK debug too:

GTK_DEBUG=interactive waybar then select CSS nodes in the menu that will give your id's and extra classes to work with.

Edit: forgot about the click event.

I don't think the group even supports click events (which makes sense tbh), so you would probably have to set the same event on each individual modules inside your group.

haug1 commented 5 months ago

I don't see a clear and obvious reason why hover should not be working with groups. After a quick glance a the code, I have a theory it may be a similar problem to the one I patched: https://github.com/Alexays/Waybar/blob/master/src/group.cpp#L98. (But haven't tested anything and maybe it's not safe to just change the behavior.)

haug1 commented 5 months ago

Forgot to update, but I've noticed my previous comment was wrong. Group was not using the GTK component of AModule, it had its own seperate override, so this is why. I made a PR, so maybe we will have this on whole groups as well soon.

haug1 commented 5 months ago

This issue is resolved as of latest release (0.10.3). Please close (or prove me wrong!), anyone who can.