Creating Plasma::Containments or Plasma::PopupApplets via the scripting api

Richard Dale richard.j.dale at gmail.com
Wed Apr 22 15:15:25 CEST 2009


We've just been discussing scripting applets on #plasma irc channel,
and I said that I didn't think it was possible to create types of
applets other than Plasma::Applet. Then I went and had a look at the
code in plasma/applet.cpp to confirm, and found this:

    if (!offer->property("X-Plasma-API").toString().isEmpty()) {
        kDebug() << "we have a script using the"
                 << offer->property("X-Plasma-API").toString() << "API";
        if (isContainment) {
            return new Containment(0, offer->storageId(), appletId);
        }
        return new Applet(0, offer->storageId(),  appletId, allArgs);
    }

Does it mean what I think it means - in that if you have a line in
your scripting metadata.desktop file:

ServiceTypes=Plasma/Containment

instead of

ServiceTypes=Plasma/Applet

then a Plasma::Containment is created for the scripting applet.

We were actually discussing Plasma::PopupApplet, and I wondered if a
similar addition to the Applet::load() code, along with a
'Plasma/PopupApplet' ServiceTypes, could be added to handle those?

-- Richard


More information about the Plasma-devel mailing list