eww icon indicating copy to clipboard operation
eww copied to clipboard

[BUG] Sliding animations don't work with revealer

Open ahmedkhalf opened this issue 3 years ago • 18 comments

Describe the bug

All slide animations just don't work with the reveler widget, however, the fade animation works.

Reproducing the issue

  1. Use this config
<eww>
    <windows>
        <window name="bar_window" stacking="fg" focusable="false">
            <geometry anchor="top left" x="0px" y="0px" width="100%" height="48px"/>
            <reserve side="left" distance="50px"/>
            <widget>
                <revealer transition="slideright" duration="1s" reveal="{{show}}">
                    <box hexpand="false">
                        <label text="lolololololol"/>
                    </box>
                </revealer>
            </widget>
        </window>
    </windows>
</eww>
  1. eww daemon
  2. eww open bar_window
  3. eww update show=true As you can see the label shows instantly and without animation
  4. eww update show=false As you can see the label hides abruptly after 1 second and without animation

Expected behaviour

I expect the sliding animations to work.

ahmedkhalf avatar Jun 24 '21 14:06 ahmedkhalf

The dimension of the widget in the direction you want the animation need to be null.

snakedye avatar Jun 24 '21 15:06 snakedye

I don't understand, can you let me know what modifocations to the xml will I need to do for it to work? @snakedye

ahmedkhalf avatar Jun 24 '21 16:06 ahmedkhalf

Make the width or height of the window 0

snakedye avatar Jun 24 '21 21:06 snakedye

It works when showing but not when hiding...

https://user-images.githubusercontent.com/36672196/123415487-66362f00-d5c6-11eb-84a8-83e2126f6b0b.mp4

code:

<eww>
    <windows>
        <window name="bar_window" stacking="fg" focusable="false">
            <geometry anchor="top left" x="0px" y="0px" width="100%" height="0"/>
            <reserve side="top" distance="40px"/>
            <widget>
                <revealer transition="slidedown" duration="1s" reveal="{{show}}">
                    <box class="main_box_bar_window" orientation="h">
                        jeff
                    </box>
                </revealer>
            </widget>
        </window>
    </windows>
</eww>

ahmedkhalf avatar Jun 25 '21 11:06 ahmedkhalf

Try this https://github.com/snakedye/eww/tree/revealer-patch

snakedye avatar Jun 26 '21 12:06 snakedye

Is this already fixed somewhere? I guess so, it does work in my case since when I started using eww (probably the last month).

https://user-images.githubusercontent.com/26714676/132976860-044e527c-d83c-4388-9be5-388531c36a78.mp4

Animeshz avatar Sep 12 '21 06:09 Animeshz

Well the main issue here seems to be that the window size doesn't get reset to 0 when hiding the contents. This means that it works within a window, but it breaks if you try to hide/show the entire window using revealer

elkowar avatar Sep 12 '21 10:09 elkowar

Wait window can be embedded into widgets? 👀

Animeshz avatar Sep 12 '21 10:09 Animeshz

no, but you can make the revealer be at the root of your window. In that case, the revealer being hidden pretty much means that the window is hidden

elkowar avatar Sep 12 '21 10:09 elkowar

Tried testing in different scenarios, there seem to be two condition for the animation to happen:

  1. Ancestor at least must be a window containing widget like expander or eventbox.
  2. Parent widget's orientation must be parallel to the animation (EventBox behave like horizontal | Expander behave like vertical | Box can have configurable orientation etc.)

A sample widget that works with slideup/slidedown using expander:

(defvar winrev false)

(defwindow topbar
  :monitor 0 :stacking "fg" :wm-ignore false :windowtype "dock"
  :reserve (struts :side "top" :distance "30px")
  :geometry (geometry :x "0" :y "0" :width "100%" :height "30px" :anchor "top center")
  (expander :expanded true
;    (box                ; still works
      (revealer :transition "slidedown" :reveal winrev :duration "1s"
        "Hello World!")))

with eww update winrev=true

EDIT: A very much related upstream issue https://gitlab.gnome.org/GNOME/gtk/-/issues/1020. Seems like this undocumented behavior is somewhat just an upstream issue to me.

Animeshz avatar Sep 12 '21 14:09 Animeshz

is there any other conditions ? i can't get a slideleft / slideright animation to work, i have this right now:

(defvar rev false)

(defwindow sidebar
  :monitor 0
  :geometry (geometry :x "0%"
              :y "0%"
              :width "25%"
              :height "100%"
              :anchor "top left")
  :stacking "fg"
  :wm-ignore "true"
  :windowtype "normal"
  (eventbox
    (revealer :transition "slideright"
      :reveal rev
      :duration "1s"
      "things")))

which should follow the conditions, but just doesn't work. Setting the width of the window to 0 gives the same behaviour as a @ahmedkhalf above, animation on enter, but not on leave (window width doesn't go back to zero as well, but content goes away).

Also, @Animeshz did you have to do anything notable to make your horizontal sliding animations work ? because yours does and i couldn't find any real difference.

viandoxdev avatar Sep 18 '21 10:09 viandoxdev

@viandoxdev You might want to check a couple of my examples here https://github.com/druskus20/eugh, I've been messing around with revealer for a bit today. I dont see anything particularly wrong with your code at first glance though. You are trying to do stuff a bit weird, because from what I can tell, you expect the whole window to hide? (or am I completely wrong here)

druskus20 avatar Oct 24 '21 19:10 druskus20

Yeah exactly, I guess title should be more clear, window hide/show does not work as expected using the revealer.

Animeshz avatar Oct 25 '21 01:10 Animeshz

Im not sure you can hide/reveal the entire window because of gtk reserves space. Though you might be able to have a window with a transparent background and then an animation for a children box.

druskus20 avatar Oct 25 '21 13:10 druskus20

Then probably this issue isn't an issue? 👀

Animeshz avatar Oct 25 '21 13:10 Animeshz

Probably not an eww issue, but rather just gtk intended or unintended behaviour

druskus20 avatar Oct 25 '21 17:10 druskus20

As this SO answer would suggest, all operations that could have possibly caused a dynamic content resize need to issue a resize request to the smallest window possible, from where GTK will constrain check it into its smallest.

This would mean resizing on each expander and revealer state change (those are the only two places I think this happens). Performance-wise, this window size recalc would happen inside GTK (if GTK did it for you) anyways, so it's practically unavoidable.

On a side-note, this link might be useful to let clicks and (probably) other events pass through to other windows below.

misterupkeep avatar Apr 11 '22 17:04 misterupkeep

Encountered this issue during my setup. Both for hiding the window (this issue) and dynamic sizing (#254). A work-around for hiding the window is hideIt.sh. However, a proper fix would be great as it allows for more dynamic widgets overall.

Kibouo avatar Jul 10 '22 13:07 Kibouo