Status on using KStatusNotifierItem for QSystemTrayIcon

Martin Gräßlin mgraesslin at kde.org
Wed Jan 29 13:52:09 UTC 2014


Hi all,

as discussed we do not plan to implement an xembed based systemtray. This 
means all applications using xembed systray icon will break. And as Qt uses 
xembed for QSystemTrayIcon this is a suboptimal solution.

The idea to solve it is to force the QSystemTrayIcon to use status notifiers 
through our QPA plugin in frameworksintegration. The good news is I have it 
working on my system, the bad news is it needs changes in Qt and thus we won't 
have it till we depend on Qt 5.3.

* Why are changes needed to Qt? *
The context menu is passed to the QPlatformSystemTrayIcon as a QPlatformMenu. 
If our implementation of QPlatformTheme does not provide a QPlatformMenu, we 
get a null pointer and don't have any information about the menu. Thus our 
status notifier loses the context menu. Not nice.

The second problem is that for X11 the QPA is not used at all. Thus when 
running on X11 our hook is not used at all. Though for Wayland it would be 
used (at least I assume so) which doesn't provide an implementation in qtbase.

* Current patches *
1. Patch to extend Qt by all I need to get the menu properly passed to our 
implementation: https://codereview.qt-project.org/76864
2. Patch to not build the X11 implementation and force to QPA:

diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index b4bbc5f..aab9719 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -29,8 +29,6 @@ SOURCES += \
 
 win32:!wince*:!winrt {
     SOURCES += util/qsystemtrayicon_win.cpp
-} else:contains(QT_CONFIG, xcb) {
-    SOURCES += util/qsystemtrayicon_x11.cpp
 } else {
     SOURCES += util/qsystemtrayicon_qpa.cpp
 }

This obviously is not a solution. If I get positive reviews on item 1 I will 
start to move the X11 implementation to the xcb plugin.

3. Implementation in frameworkintegration: branch systray in 
kde:clones/frameworkintegration/graesslin/frameworkintegration or as commit 
link: 
http://commits.kde.org/clones/frameworkintegration/graesslin/frameworkintegration/bf2a398ff6105aff4349c5eba37283f0326bd8ec

The patches contain a small demo application which you can use to play with.

Any support on the Qt code review will be appreciated :-)

Cheers
Martin
-------------- 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/plasma-devel/attachments/20140129/f6af1441/attachment.sig>


More information about the Plasma-devel mailing list