detection if applet is running

Aaron J. Seigo aseigo at kde.org
Fri Oct 28 07:38:03 BST 2011


On Thursday, October 27, 2011 23:35:52 Andriy Rysin wrote:
> I did a quick research and I see two ways to solve this in
> keyboard_layout_widget (embedded component used in lockdlg):
> 1) link plasma libs and do something like (in pseudo-code)
> foreach(containment, new Corona()->containments()) {
>   foreach(applet, containment->applets()) {
>     if( applet->pluginName() == "..." ) {
>          // show indicator
>     }
>   }
> }

that won't work out of the plasma-desktop process, so this isn't an option for 
you.

> 2) make keyboard layout applet exposes some dbus to make it detectable
> when running (feels a bit too "heavy")

that would be a preferred way ... note, however, that one can have multiple 
instances of the same applet. this is why we really recommend and encourage a 
separation between visualization and business logic, where the various 
visualizations (e.g. applets, tray icons, etc) all share the same business 
logic code (e.g. a DataEngine) which can then take care of things like 
registering a unique dbus interface.

> It felt like there must be a way currently to use dbus on plasma to
> query running applets (which would the easiest way to implement what I
> need)

nobody has written such a thing, nor do i think it would be as easy as one may 
think to use as a widget may be running not in plasma-desktop but in plasma-
netbook, plasma-active, plasma-windowed, etc. and it may be in any number of 
running containments.

it is much easier and safer to simply expose a dbus service from your 
DataEngine, or whatever the DataEngine uses to get keyboard information from, 
than any other approach. it guarantees it works with multiple widgets and 
doesn't care which shell the user is running.

in this particular case, why don't you just check the keyboard layout settings 
to see if more than one keyboard layout is active? does it matter that there 
is or isn't a keyboard layout switcher applet or icon? note that in plasma 
active, it is very likely that this functionality will end up integrated into 
the virtual keyboard and not reside as a separate applet in the containments 
running in plasma-active  ...

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20111028/fe8dca46/attachment.sig>


More information about the kde-core-devel mailing list