yshui / picom

A lightweight compositor for X11 with animation support
https://picom.app/
Other
4.16k stars 589 forks source link

Add the ability to make custom animation presets #1320

Open 0neGal opened 2 months ago

0neGal commented 2 months ago

Currently you can only use the pre-compiled presets, while these are great, they're only useful if you like the presets and the configuration options they've. And if you instead want some proper custom animations, and want specific animations per window type, etc, then you're going to be repeating yourself a lot.

And so I propose the ability to make your own presets that can be used.

They would function mostly identically to animation_presets.conf for the preset themselves, and the syntax could be something like this:

# Very barebones presets, I'm not entirely certain on whether the config
# parser supports labeled arrays/objects? If not it may be a better idea
# to have the array items have an extra property for the name of preset
# instead, i.e:
#
#   animation-presets = ({
#       preset-name: "fade"
#   })
#
animation-presets = (
    fade = {
        opacity = {
            duration = "placeholder0";
            start = "window-raw-opacity-before";
            end = "window-raw-opacity";
        }

        *knobs = {
            scale = 0.95;
            duration = 0.2;
        }

        *placeholders = ((0, "duration"));
    },

    fade-and-slide = {
        opacity = {
            duration = "placeholder0";
            end = "window-raw-opacity";
            start = "window-raw-opacity-before";
        }

        offset-y = {
            start = 0;
            end = "window-height";
            duration = "placeholder0";
        }

        *knobs = {
            duration = 0.2;
        }

        *placeholders = ((0, "duration"));
    }
)
servimo commented 1 month ago

It's not implemented yet? Will it be?

0neGal commented 1 month ago

See this: https://github.com/yshui/picom/issues/1121#issuecomment-2302459185