Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KWin contribution guide #435

Open
Reginald-Gillespie opened this issue Apr 5, 2024 · 4 comments
Open

Add KWin contribution guide #435

Reginald-Gillespie opened this issue Apr 5, 2024 · 4 comments
Labels
contributions welcome Most likely, I will not work on this in the next couple of weeks documentation Improvements or additions to documentation good first issue Good for newcomers KDE The bug is specific to KDE

Comments

@Reginald-Gillespie
Copy link

Reginald-Gillespie commented Apr 5, 2024

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

@Reginald-Gillespie Reginald-Gillespie added the feature request New feature or request label Apr 5, 2024
@Schneegans Schneegans added documentation Improvements or additions to documentation KDE The bug is specific to KDE and removed feature request New feature or request labels Apr 5, 2024
@Schneegans
Copy link
Owner

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 😉

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:

  • The effect's directory in in the kwin subdirectory. Maybe choose a simple one like tv or something which looks close to what you have in mind.
  • Then you'll also have to copy and rename the corresponding shader file in resources/shaders.
  • Finally, you have to add one line like this to the build script.

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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.

@Schneegans Schneegans changed the title KWin implementation guide status Add KWin contribution guide May 25, 2024
@Schneegans Schneegans added contributions welcome Most likely, I will not work on this in the next couple of weeks good first issue Good for newcomers labels May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome Most likely, I will not work on this in the next couple of weeks documentation Improvements or additions to documentation good first issue Good for newcomers KDE The bug is specific to KDE
Projects
None yet
Development

No branches or pull requests

2 participants