Schneegans / Burn-My-Windows

🔥 Disintegrate your windows with style.
GNU General Public License v3.0
2.66k stars 77 forks source link

Add KWin contribution guide #435

Open Reginald-Gillespie opened 5 months ago

Reginald-Gillespie commented 5 months ago

The Idea

Hey! I was just curious what the status is on KWin stability for the making effects / contributing on KWin will be implemented? I know essentially nothing about GLSL but I want to learn then try a few things out with making my own effects.

The Alternatives

Me figuring it all out on my own lol

Schneegans commented 5 months ago

Hi there! I currently have not much time for it. But it shouldn't be too difficult to get started! Maybe I can just give you some pointers and then you can just try getting something running.

And maybe, maybe you feel confident to enough to submit a brand-new guide as pull request yourself :wink:

If you want to create an effect for KWin only (and this is fine, if you create something cool I can easily port it to GNOME), you can simply copy an existing effect and start from there. This requires three things:

That's basically it! You can now build and install the effects as usual. If you modifiy something in your shader source file, you'll have to run the build script, copy the files as described in the README, and reselect the effect in the system settings.

Maybe you can try this first and if it's working I can provide some more hints, tips, and tricks!

Reginald-Gillespie commented 5 months ago

Cool thanks - I was able to get it all working. One question, for developing the effect, it is a long process to do all the build and reapplying. Is there an faster development method? Some way to preview the shader as you write it?

If not I'll just write a bash script to build, apply, and restart plasmashell myself. I thought about symlinking ~/.local/share/kwin/effects/kwin4_effect_fire_copy/contents/shaders/fire-copy.frag to the development version, but the common.glsl in in there. Maybe I can just edit that one live to see the effect and then copy over just the effect's shader part.

still have to learn how to even use glsl

Schneegans commented 5 months ago

Yeah, a one-liner should do this. Something like ./kwin/build.sh && tar -xf kwin/burn_my_windows_kwin4.tar.gz -C ~/.local/share/kwin/effects. You do not need to restart the shell, only reselecting the effect in the system settings should be sufficient. So select another effect, hit Apply, select your effect, hit Apply once more. Maybe there is a way to script this as well?

During development, I did a lot of prototyping on https://www.shadertoy.com/. This can be used to develop most parts of the effects!

Reginald-Gillespie commented 5 months ago

I can script selecting new effects, but I have yet to find a way to refresh the screen to actually apply the effect like the settings apply button does, that's why I said I'll probably have to script killing and restarting plasma, fastest way I've found.

Thanks! Will look into.