Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

:hover is not working, only on #workspaces?

Open AndreasBackx opened this issue 5 years ago • 10 comments

Is it true that adding a hover effect in CSS only works for the sway module for the id workspaces? I can only get it to work for that. I wanted to enable a hover effect when hovering over modules so I know that it is the right one I'm clicking.

Regarding this same problem, the way to have different colors for icons also would not work here because the CSS in GTK probably doesn't override the HTML defined in the modules. #50

"format": "<span color=\"#fff\">{}</span>"

The span element's color would not be able to change on hover or any way at all in CSS. Defining a span inside of the module without a color attribute and trying to change the color of that span inside of there also doesn't work it seems.

AndreasBackx avatar Apr 22 '19 20:04 AndreasBackx

I'm also interested in toggling bg/fg on hover. Took me a while to realize that it only works on #workspaces ^^

AdrienLemaire avatar Jan 30 '20 04:01 AdrienLemaire

why is this ? I want to try and toggle to make the bar disappear until mouseover ::(

ghost avatar Feb 13 '20 02:02 ghost

I could specifically use :hover on #custom-xxx:hover elements

Also, :first-child and :last-child would help in instances where buttons are grouped together and the first and last in the group need some kind of curved border-radius or other visual difference.

lorendias avatar Apr 27 '20 20:04 lorendias

Yeah, this seems obvious when we have css... why would this not work?

Kommynct avatar May 26 '20 01:05 Kommynct

On GTK side, hover seem to work only on button and as workspaces use gtk buttons..

Alexays avatar May 27 '20 07:05 Alexays

Perhaps everything should or at least being considered a button could maybe be toggleable? I certainly click on my other modules, and I find that hinting something is clickable with a hover effect helps ease of use.

Kommynct avatar May 27 '20 11:05 Kommynct

Would love to have this as a feature. Being able to apply hover CSS to modules would let me visually differentiate between which ones have clickable actions.

Hermitter avatar Aug 19 '20 03:08 Hermitter

I could specifically use :hover on #custom-xxx:hover elements

Also, :first-child and :last-child would help in instances where buttons are grouped together and the first and last in the group need some kind of curved border-radius or other visual difference.

I was able to put the entire box inside another box layer, from which I could I could group together the modules in their own boxes.. basically just wrapping and grouping everything together. This allows the bars to resize based on text/components and hover features while allowing a minimal space to be occupied.

If I could just figure out how to incorporate a hover feature to the entire bar, without having to rewrite the entire code - where the entire bar just becomes a height of 2px and transparent - this would be the dream bar. screenshot-23

ghost avatar Aug 22 '20 19:08 ghost

Any update on this?

#clock:hover {
     backround:#232332;
}

I'd like to have this CSS setting

mizzunet avatar Dec 07 '21 06:12 mizzunet

For those of y'all who are want those cool animations for hovering, I found a pretty good way to do it. Hover effects seem to be exclusive to GtkButtons. I checked out PR #1120 because it forced elements with an on-click event to be GtkButtons. From there I could do whatever :hover stuff I wanted.

https://user-images.githubusercontent.com/42098470/172022640-74673166-2609-4776-af24-3b99dc3087c2.mp4

This might be a bit too brief, so if you have any questions please ask, I've definitely had a few complications. For instance, the actual label is nested inside the Button so when, for example, setting the label color, you need to do the following.

#mycoolclass label {
 color: blue;
}

NOTE: By using #1120 you will probably have a lot of spacing issues because of this nested GtkLabel having its own margin and padding so keep that in mind when switching to it.

Zaedus avatar Jun 04 '22 19:06 Zaedus

Since I had unexpected hover effects everywhere where I have an on-click definition after upgrading to 0.9.15 I guess this is now fixed :slightly_smiling_face:

rnestler avatar Nov 09 '22 14:11 rnestler

It's possible to rewrite all modules from ALabel to Button?

https://github.com/Alexays/Waybar/blob/master/src/modules/custom.cpp#L7

zerkalica avatar Jan 11 '23 14:01 zerkalica

@zerkalica Is this why I'm having problems?

From what I read, anything with an on-click handler is supposed to be a gtkmm__GtkButton, however, the #bluetooth widget is not a button but rather a GtkEventBox containing a GtkLabel. This makes it impossible to use #bluetooth:hover as a valid selector.

spikespaz avatar Jan 16 '23 03:01 spikespaz

@Alexays This seems like a major drawback of Waybar that has not been addressed, in addition this issue seems to be closed, could you reopen this issue?

window#waybar should have an :hover state or at least .horizontal:hover. It shouldn't be only buttons as it is very confusing and undocumented mismatch.

izelnakri avatar Oct 15 '23 12:10 izelnakri

and :hover on on-click elements stop working again...

loegaire avatar Oct 18 '23 06:10 loegaire

why is this issue closed? this is a really fundamental part of css thats straight up being ignored. i cant even get custom on-click functions to hover anymore. whats up with that? feels like an oversight that the only things hoverable are workspaces.

notmugi avatar Oct 26 '23 05:10 notmugi

Not sure if you guys have looked into the source, but there's no QC...

spikespaz avatar Oct 26 '23 05:10 spikespaz

#custom-XXX:hover still not work. Even with on-click exists

"custom/apps": {
    "format": "Apps",
    "on-click": "pkill -x rofi || rofi -show drun"
},
#custom-apps:hover {
    color: red;
}

zlietapki avatar Dec 12 '23 11:12 zlietapki

I also would love to have this!

phrogg avatar Jan 03 '24 10:01 phrogg

Damn this isn't a thing yet.

5p4r74cu5 avatar Jan 07 '24 07:01 5p4r74cu5

Does this feature implemented or will it? I tried #custom-module button.focuesed and :hover but it doesn't works. The module has on-click event too.

mkaramuk avatar Feb 05 '24 19:02 mkaramuk

it doesnt seem to be possible unfortunately

samisul avatar Mar 01 '24 23:03 samisul

And the issue is still closed.

EaGLexEyE avatar Mar 05 '24 14:03 EaGLexEyE

Well it worked at some point, but then got removed again since it caused issues. Maybe it would be worth to create a new feature request for it?

rnestler avatar Mar 05 '24 15:03 rnestler

Done: #2989.

5p4r74cu5 avatar Mar 06 '24 01:03 5p4r74cu5