kdelibs/kded/HOWTO
Ivailo Monev e482da9067 kded: rework phases logic to take any desktop session into account
much like XDG autostart except for KDED modules, requires adjustments to
modules that are automatically loaded in phase-1

in the future the logic may apply not only to modules during startup but
also when attempting to load a module in general

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-31 23:01:34 +03:00

46 lines
2.1 KiB
Text

HOWTO Make KDED Modules
=======================
A KDED module implementation looks similar to a KControl module.
A module is loaded when a call is made to it.
KDED modules should not be added if it is avoidable because (especially
when new) they endanger the stability of KDED and its other modules which
provide important services. There are other ways to achieve what a KDED
module can do in many cases.
KDED modules should be useful during the whole session and manage
information that, for some reason, cannot be kept in any other process.
Here are examples of KDED modules:
kdelibs/kutils/kmediaplayer/kded/kaudioplayer.cpp Audio player module for playing notification and accessibility sounds
kde-workspace/lib/konq/favicons/favicons.cpp Favicons module for downloading favicon.ico files
A KDED module should install a .desktop file with
ServicesTypes=KDEDModule
A KDED module will be loaded on KDE startup if it has a line
X-KDE-Kded-autoload=true
Note that this flag doesn't cause the module to be loaded if the KDE desktop
is not running (i.e. when running a KDE application in another environment).
[The following paragraph was copied from kdebase/workspace/ksmserver/README]
The exact way autoloading works is controlled by X-KDE-Kded-phase=,
which may be 0, 1 or 2 (the default). Kded phase 0 means the module is
always loaded by kded, even outside of the current desktop session. It should
used only by kded modules which must be always running. Kded phase 1 modules are
loaded right after kded startup and is for modules that must be loaded for
specific desktop session. Phase 2 modules will be loaded later by ksmserver
and only for KDE session.
Normally KDED modules are loaded whenever they are accessed, so you don't
need autoloading enabled. On demand loading can be disabled by putting
the following line in the .desktop file:
X-KDE-Kded-load-on-demand=false
Further it should contain:
X-KDE-Library=foo
Which means that kded_foo.so is the name of the library that contains
the module. Note that the name of the library always starts with kded_.
The .desktop file should be installed to ${KDE4_SERVICES_INSTALL_DIR}/kded