[effects] Make scripted effects GHNS-able
ClosedPublic

Authored by zzag on Sep 9 2018, 11:26 AM.

Details

Summary

Currently, if one wants to install a scripted effect from the KDE Store,
the effect won't show up in the Desktop Effects KCM. The reason for that
is kpackagetool5 doesn't know where to install effects (they have to be
installed under ${DATA_DIR}/kwin/effects).

Another problem is that even if the scripted effect is installed in the
right directory (e.g. ~/.local/share/kwin/effects), it won't be listed in
the Desktop Effects KCM because it doesn't have a desktop file in
kservices5 dir. Please notice that the effect will be "visible" for KWin, i.e.
you can enable it by editing kwinrc.

This diff addresses those 2 problems by:

  • Adding a PackageStructure plugin for effects (so they are installed under kwin/effects/);
  • Using KPackage::PackageLoader to get list of scripted effect in the Desktop Effects KCM.
Test Plan
  • Installed an effect from the KDE Store, it appeared in the Desktop Effects KCM;
  • Removed it.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Sep 9 2018, 11:26 AM
Restricted Application added a project: KWin. · View Herald TranscriptSep 9 2018, 11:26 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Sep 9 2018, 11:26 AM
zzag retitled this revision from [effects] Make scripted effect GHNS-able to [effects] Make scripted effects GHNS-able.Sep 9 2018, 11:27 AM
zzag edited the summary of this revision. (Show Details)
zzag edited the summary of this revision. (Show Details)
zzag updated this revision to Diff 41264.Sep 9 2018, 3:29 PM

Don't use rawData

zzag updated this revision to Diff 41265.Sep 9 2018, 3:32 PM

Fix typo in my last name

It's a bit weird to use kpackage here but not in ScriptedEffect itself but we can deal with that later.

I have a vague recollection of this previously being blocked on the grounds of "security" but I can't see it in my logs anywhere.

kcmkwin/kwincompositing/model.cpp
28–29

can we drop these?

packageplugins/effect/effect.cpp
35

The exact file path is hardcoded as config/main.qml, at which point we should add a fileDefintion for that instead

42

Where is effect defined?

zzag added a comment.Sep 17 2018, 2:05 PM

It's a bit weird to use kpackage here but not in ScriptedEffect itself but we can deal with that later.

ScriptedEffectLoader also uses KPackage.

packageplugins/effect/effect.cpp
42

Copy-paste.

I also wonder why other package structure plugins do the same. Can we drop it?

zzag updated this revision to Diff 41848.Sep 17 2018, 3:17 PM

Address inline comments

zzag marked 3 inline comments as done.Sep 17 2018, 3:18 PM
zzag updated this revision to Diff 41850.Sep 17 2018, 3:21 PM

More cleaner keys

zzag updated this revision to Diff 41851.Sep 17 2018, 3:29 PM

Edit file names

zzag updated this revision to Diff 41852.Sep 17 2018, 3:34 PM

Add missing Q_OBJECT macro

mart added inline comments.Sep 21 2018, 11:38 AM
packageplugins/effect/effect.cpp
42

drop what?

zzag added inline comments.Sep 21 2018, 11:39 AM
packageplugins/effect/effect.cpp
42
davidedmundson accepted this revision.Fri, Sep 28, 11:34 AM
This revision is now accepted and ready to land.Fri, Sep 28, 11:34 AM
This revision was automatically updated to reflect the committed changes.