Window switch notification for plasma applets

Andriy Rysin arysin at
Sat Apr 23 16:47:11 BST 2011

On 04/14/2011 12:40 PM, Aaron J. Seigo wrote:
> On Wednesday, April 13, 2011 20:31:01 Andriy Rysin wrote:
>> well as per top-level windows. So the question is whether there's a way to
>> tell "active/focused" applet and get notified on switch?
> ah, and getting the current view() for the Applet or even checking the PID
> (since the switcher could be running in another non-desktop shell, e.g.
> plasma-windowed) might be useful too.
So I played with it briefly and I can get focusItem inside the applet 
(if I don't set focus policy to NoFocus) but the problem is that the 
code which maps layouts to windows/applications reside in keyboard 
daemon which knows nothing about keyboard applet etc. I could of course 
notify keyboard daemon from keyboard layout applet (e.g. via dbus) that 
it became active/inactive but that's quite ugly. More than that there 
might be other applets which don't want to steal "focus" from windows.
One such example is virtual keyboard applet - when it's clicked we most 
probably don't want to switch active window (to desktop) and change 
layout. So it would be nice to have some more generic solution.

I could put a workaround in keyboard daemon to exclude "keyboard layout" 
and "virtual keyboard" applets from stealing active window but I would 
need to know how to get "focused/active" applet from outside of applet. 
And any help here is appreciated.


More information about the kde-core-devel mailing list