Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Allow setting all animation props (speed, curve, etc) in window/layer rules.

Open vaxerski opened this issue 7 months ago • 6 comments

Discussion Link

https://github.com/hyprwm/Hyprland/discussions/9885

Description

Currently, the animation windowrules only set style. We should expand them to allow setting all the properties. Now that we use animation variables from hyprutils, I believe this shouldn't be hard.

vaxerski avatar Apr 06 '25 00:04 vaxerski

Hi, I'd like to make this feature happen

Let me sup up the current situation vs what we would like to get to make sure I understand correctly (sorry in advance for the lengthy message):

Current situation

Currently, window/layer animations can be set "globally" with the animation = keyword in the config. The affected animations are:

  • windows
    • windowsIn
    • windowsOut
    • windowsMove
  • layers
    • layersIn
    • layersOut

In this global config, we can set the following properties:

  • ON / OFF
  • Speed
  • Curve
  • Style (Only supported for windows and layers)

The animation style set for windows affects both windowsIn and windowsOut ; the style set for layers affects both layersIn and layersOut ; there is no way to set the animation style for the subcategories specifically.

On the other hand, window/layer rules allow to tweak these animations properties by matching specific windows

Currently, rules can only set the animation style, as if it were animation = {windows|layers}, <no change>, <no change>, <no change>, <new style>. The docs mention that windowrule animations can specify an optional "opt" ; I have no idea what this does though.

What we'd like to have

Simply enable window/layer rules to also tweak animation speed and curve.

Some questions

Since the rules are window and layer rules, I assume they would "replace" windows and layers in the anim tree, but then what if you also have a global windowsIn anim for example, should the windowrule take precedence? Or could we allow rules to set specific animations (i.e. windowsOut, layersIn)?

For my use case I'd like to set a specific windowsOut but keep the global windows anim.

Could we also allow anim styles to be different for in and out animations?

As a final sidenote, I think it would be more accurate to call the number representing animation speed a duration, because it is actually a duration, but this doesn't matter that much, it's just somewhat confusing.

C0Florent avatar Apr 12 '25 18:04 C0Florent

For my use case I'd like to set a specific windowsOut but keep the global windows anim. Could we also allow anim styles to be different for in and out animations?

You can already do that. This is for getting one specific window to have a different animation than others.

vaxerski avatar Apr 14 '25 21:04 vaxerski

For my use case I'd like to set a specific windowsOut but keep the global windows anim. Could we also allow anim styles to be different for in and out animations?

You can already do that. This is for getting one specific window to have a different animation than others.

You mean I can have a window appear with popin and then slide out? (without setting its style via IPC once it's open)

The docs seem to indicate that the style can only be set for windows ; not windowsIn nor windowsOut specifically

Anyways my point is not necessarily about different anim styles for winIn/winOut, but rather being able to target winIn/winOut in windowrules.
Here's my use case: my global anims on windows is a slide with an overshot curve, then I override the style for floating/single windows to be popin, which looks fine on windowsIn but I find an overshot curve on popin windowsOut a bit weird.
I would like to be able to have a windowrule that changes anim style for both windowsIn and windowsOut, plus change anim curve on windowsOut

We would need to decide on syntax that allows setting windowsOut/windowsIn specifically with a windowrule ; not only windows

C0Florent avatar Apr 15 '25 08:04 C0Florent

You mean I can have a window appear with popin and then slide out?

yes

Anyways my point is not necessarily about different anim styles for winIn/winOut, but rather being able to target winIn/winOut in windowrules.

well then your original comment was a bit unclear to me, but yes, this is what the issue is about

vaxerski avatar Apr 15 '25 12:04 vaxerski

You mean I can have a window appear with popin and then slide out?

yes

Well this works indeed, I never knew. Created https://github.com/hyprwm/hyprland-wiki/pull/1035 to document it in the anim tree docs.

With that sorted, I'd like to start working on the feature. I started looking at some files like AnimationManager, Window, WindowRule to get a feel of what I'm working with (would be my first contribution). Could you give me some clues as to where changes should be made for this feature in your opinion? I'd guess a good starting point would be the windowrule parser, but I'm not sure.

C0Florent avatar Apr 15 '25 22:04 C0Florent

check updateDynamicRules and the override methods of hyprutils' animatedvariable

vaxerski avatar Apr 18 '25 19:04 vaxerski