Bug 314595

Summary: KStatusNotifierItem not working in newer versions of KDE 4
Product: [Frameworks and Libraries] kdelibs Reporter: lpugoy
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 4.9.98 RC3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description lpugoy 2013-02-07 12:23:13 UTC
Hello. I have an applet that uses KStatusNotifierItem of PyKDE4. In Arch Linux with versions as such (Qt - 4.8.4, KDE Development Platform - 4.9.5) taken from kde4-config -v, it works.

However, in Kubuntu 12.10 with versions (Qt - 4.8.3, KDE Development Platform - 4.9.98), it's not working.

Here's an example of the code: http://pastebin.com/Ayc9MZYh. It uses QApplication, but a similar snippet that uses KApplication also does not work.

The Python application is confirmed to be connected to D-BUS by checking qdbus.

The icon is also not in the hidden icons section of the system tray, nor is it in the Entries section on the System Tray settings. For Arch Linux it is visible in the system tray and it is included in the Entries section.

Reproducible: Always

Steps to Reproduce:
1. Copy the code above to any file.
2. Execute it.
Actual Results:  
The icon is not in the system tray.

Expected Results:  
The icon should have been in the system tray.

The 4.9.98 packages were installed in Kubuntu using the PPA https://launchpad.net/~kubuntu-ppa/+archive/beta.
Comment 1 Aaron J. Seigo 2013-02-07 14:19:09 UTC
this is because your icon has no id. changing:

self.tray = KStatusNotifierItem(self)

to:

self.tray = KStatusNotifierItem("someId", self)

causes it to show. or register data with the main component (e.g. via KAboutData).

the problem is that you do not have a name in the main component and so it can't find one to assign automatically. in previous releases, apparently the system tray didn't care about this (which undoubtedly broke other things). it also means that *no* configuration could be saved for that entry, nor any reliable way of referencing it at runtime made (other than the dbus service itself). that it worked previously was something of an accident.
Comment 2 lpugoy 2013-02-08 02:17:40 UTC
Thanks. I was able to confirm that that resolved the issue.