Revision 2208001...

Go back to digest for 9th February 2014

Features in KDE Base

Sebastian Kügler committed changes in [kde-workspace] /generic/applets/systemtray/plugin/protocols/plasmoid:

[Systemtray] DBus-activation for Plasmoids

This feature allows loading and unloading Plasmoids when dbus services
come and go. Applets can specify in their metadata which service should
control their lifecycle.

This has the following advantages:
- We can dynamically only load Plasmoids when they're useful
- Applications can provide Plasmoids that appear and disappear bases on
the application running
- We can load controls for system service dynamically as they come and
go
- It makes it easier to delay loading of Plasmoids on startup until when
a specific service appears
- It makes Plasmoids and features more discoverable

One immediate user for this is the media controller applet, which will
now only be loaded once an MPRIS2-compatible media player is running.

Internally, this works as follows:
- we collect a list of plugins and related services in
m_dbusActivatableTasks
- we query DBus for the list of services, async (initDBusActivatables())
- we go over that list, adding tasks when a service and plugin match
(serviceNameFetchFinished())
- we start watching for new services, and do the same
(serviceNameFetchFinished())
- whenever a service is gone, we check whether to unload a Plasmoid
(serviceUnregistered())

Adding the following to the metadata.desktop file will trigger loading
the applet whenever a service matching the service name appears. The
applet will automatically be unloaded once the service disappears.

X-Plasma-DBusActivationService=org.mpris.MediaPlayer2.

This feature was discussed and requested during the Plasma Sprint in
Barcelona.

DIGEST:[Systemtray] DBus-activation for Plasmoids in system tray

File Changes

Modified 2 files
  • /generic/applets/systemtray/plugin/protocols/plasmoid
  •   plasma/plasmoidprotocol.cpp
  •   plasma/plasmoidprotocol.h
2 files changed in total