问题
There is no tray in Unity under Ubuntu 11.04.
How can I make icon appear somewhere in Unity? wx.TaskBarIcon is not appear anywhere. Thanks
回答1:
Best answer to give is from the official Documentation:
Under X Window System, the window manager must support either the System Tray Protocol by freedesktop.org (WMs used by modern desktop environments such as GNOME >= 2, KDE >= 3 and XFCE >= 4 all do) or the older methods used in GNOME 1.2 and KDE 1 and 2. If it doesn't, the icon will appear as a toplevel window on user's desktop.
Because not all window managers have system tray, there's no guarantee that wxTaskBarIcon will work correctly under X Window System and so the applications should use it only as an optional component of their user interface. The user should be required to explicitly enable the taskbar icon on Unix, it shouldn't be on by default.
http://docs.wxwidgets.org/stable/wx_wxtaskbaricon.html
So this is related to your windowmanager, not programming wxWidgets. wxTaskbarIcon is only reliable under wxMSW, dunno about mac. Best is to avoid it if you want real XPlatform-Applications.
回答2:
With Ubuntu Unity desktop environment (i.e. Ubuntu 11.04 or 11.10), you need to "whitelist" your application.
There are different ways to do this using the 'gsettings' application from the command line.
I had to do this to get programs like Skype showing in the system tray again, not just for my own custom apps that use wxPython.
回答3:
If you're making a new application, consider using the newer libappindicator library instead – it’s Ubuntu's successor for the systray which should be compatible with GNOME 2.x at least. (I've no idea if either GNOME 3 or KDE support displaying libappindicator notifications anywhere.)
来源:https://stackoverflow.com/questions/7144756/wx-taskbaricon-on-ubuntu-11-04