Have widget appear in the place of another when hovered #862
-
This is pretty complicated to explain. Here it goes. I have a small media widget within my bar, which currently displays the title and artist(s) of the media that is currently playing. I want to be able to hover over the media details, and have the text disappear. Easy enough. I then want some media controls to appear in the place where the text was. I've figured out how to get the media controls to appear when I hover over the text, but they appear to the right, and take up space even when not visible. Can someone help me with this? Edit: here is what I have so far. I have managed to get the widgets to disappear and appear, but they still appear next to each other, not overlapping each other.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You probably want to use a (maybe two) revealer for that. They're a bit finicky (tend to break for absurd reasons, see #196) but should get the work done here. For a crossfade you could use overlays too. |
Beta Was this translation helpful? Give feedback.
-
I did this in my config here if you want a full reference. The basic gist is that you want ; Some defined state for expanding and retracting
(defvar expanded `false`)
(defwidget SomeWidget
; Something to collect the state updates
; By wrapping the other content, you make sure that it stays expanded while
; working with the revealed content.
(eventbox
:onhover `${EWW_EXECUTABLE} update expanded=true`
:onhoverlost `${EWW_EXECUTABLE} update expanded=false`
; Something to be visible while hovered
(revealer
:reveal { expanded == true }
(HoverContent))
; Something to be visible while not hovered
(revealer
:reveal { expanded == false }
(UnHoveredContent))) The biggest issue I've run into comes from the fact that |
Beta Was this translation helpful? Give feedback.
-
Thanks to @oldwomanjosiah and @viandoxdev, I have managed to get it working the way I want it to.
Key items I used to figure this out:
If someone can center the controls with something other than a centerbox and two empty boxes, please send it here. |
Beta Was this translation helpful? Give feedback.
Thanks to @oldwomanjosiah and @viandoxdev, I have managed to get it working the way I want it to.
Here is a minimal example: