问题
I built wxWidgets 2.9.3 (for the moment I must stick to this version) under Ubuntu 12.10 and I can't seem to use wxTaskBarIcon
class. The sample which is delivered with wxWidgets is compiling and running, but the icon itself is not showing on the taskbar itself. I checked my config, and I know, that compilation of wxWidgets libraries were executed with default setting (which is "yes" for taskbar support).
Any idea how to make it working? Is this problem related with wxWidgets and/or Ubuntu version?
Edit: It is definitely not connected to the wxWidgets version (checked under wx 2.8, 2.9.3, 2.9.4).
Edit 2: In case it matters: System is on VirtualBox 4.2.6, installed with the all default settings. I am installing updates at least once a week.
回答1:
Under Ubuntu since 11.04 taskbar is managed by Unity which by default doesn't allow all programs to put their icons there. You must whitelist your application to let it access taskbar. Here is where I found the answer originally:
http://ubuntuforums.org/showthread.php?t=1737589
Basically you must call:
gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'YOUR_APPLICATION']"
Then log out, log in. This will add YOUR_APPLICATION to the Unity.Panel whitelist. Bear in mind that in this case you must also list items which were on that list beforehand. You can check how whitelist looks by calling:
gsettings get com.canonical.Unity.Panel systray-whitelist
In my case (as I am working on development environment) I just set it to "['all']"
. This will allow all applications to access taskbar.
Bear in mind that Ubuntu will be dropping such support and in the future you should use AppIndicator library instead to achieve that goal. This means, that wxTaskBarIcon won't be working even with whitelist unless it'll be using AppIndicator library.
Source: http://www.webupd8.org/2013/02/unity-notification-area-systray.html
来源:https://stackoverflow.com/questions/14521006/wxtaskbaricon-in-ubuntu-12-10