Xpra: Ticket #43: tray icon and menu icons are blank

Using: Ubuntu 10.04 Lucid

Even though it the logs show the icon_file is detected, the icon does not show in my tray notification area. There's a smallish (10px) blank space which I can click to get the menu.

None of the menu items have icons either, some have a no-entry style icon, which I think means bad image, or similar.

I'm happy to help debug, but I'm not sure where to start.

Log:

$ xpra attach -d all |& head -n 20
parse_shortcuts(['meta+shift+F4:quit'])
parse_shortcuts(['meta+shift+F4:quit'])={'F4': (['meta', 'shift'], 'quit')}
get_icon_filename(xpra.png)=/usr/share/xpra/icons/xpra.png, exists=True
set default window icon to /usr/share/xpra/icons/xpra.png
get_icon_filename(information.png)=/usr/share/xpra/icons/information.png, exists=True
get_icon_filename(configure.png)=/usr/share/xpra/icons/configure.png, exists=False
get_icon_filename(slider.png)=/usr/share/xpra/icons/slider.png, exists=True
get_icon_filename(keyboard.png)=/usr/share/xpra/icons/keyboard.png, exists=True
get_icon_filename(retry.png)=/usr/share/xpra/icons/retry.png, exists=True
get_icon_filename(quit.png)=/usr/share/xpra/icons/quit.png, exists=True
get_icon_filename(close.png)=/usr/share/xpra/icons/close.png, exists=True
get_tray_icon_filename using default: /usr/share/xpra/icons/xpra.png
write thread: waiting for data to write
read thread: waiting for data to arrive
'setxkbmap -query' failed with exit code 255


Tue, 15 Nov 2011 17:06:50 GMT - Antoine Martin: status, description changed


Tue, 15 Nov 2011 17:09:55 GMT - Antoine Martin:

oh great, another broken Ubuntu API to fix... I assume you are using "Unity", and I have experienced something similar with WinSwitch: IIRC the old API in 10.04 fails to use the absolute path we give it, and fails even further by not even placing some kind of placeholder icon there... sigh


Tue, 15 Nov 2011 17:45:55 GMT - Norman Rasmussen:

Not using Unity yet, still Gnome v2, afaik. (I think Unity comes with Gnome v3?)


Tue, 15 Nov 2011 21:39:38 GMT - Doug Doole:

I see this under KDE 4 as well. (kubuntu 11.04)


Wed, 16 Nov 2011 04:52:32 GMT - Antoine Martin:

Hah, it may well be that the code tries to use the new Ubuntu "indicator" API (re-inventing another wheel: tray icon under another name) since it is installed, but it may not be functional since you are not using the unity desktop... great, now I need to find a way to detect if the API actually works before using it.


Thu, 24 Nov 2011 11:40:48 GMT - pmarek:

I'm on debian; winswitch shows icons in the tray and the menu, but xpra does not (apart from the ✓ beneath Bell etc.).

Hints for debugging appreciated.


Thu, 24 Nov 2011 17:55:58 GMT - Antoine Martin:

Confirmed: as I expected it uses the appindicator API if it is present before trying to use the gtk.StatusIcon API, and since this re-invented wheel doesn't work properly (especially in Ubuntu 10.x)... You end up with the missing tray icon (this one is fixable) and missing menu entry icons (not fixable - this is a "feature").

I have also noticed that the encoding menu does not work, whereas the other menus more or less do - albeit without the icons.

Until I can figure out what to do with this horror, you can apply this patch to disable appindicator completely:

Index: xpra/xposix/gui.py
===================================================================
--- xpra/xposix/gui.py	(revision 296)
+++ xpra/xposix/gui.py	(working copy)
@@ -88,6 +88,7 @@
             return False
     def setup_appindicator(self, tray_icon_filename):
+        return False
         try:
             import appindicator            #@UnresolvedImport
             filename = self.get_tray_icon_filename(tray_icon_filename)

Next I will have to figure out in which case to use one API over the other... fun, not.


Fri, 25 Nov 2011 21:35:38 GMT - Antoine Martin:

These test results are absolutely shocking:

All other distros work just fine with statusicon, so really this is only an Ubuntu thing.


So, it looks like we will need to detect the desktop environment ("${DESKTOP_SESSION}") as well as the Ubuntu release ("lsb_release -a" ?) to decide on which api to use... How about debian? Is there a better way to detect this brokenness? IMNSHO: this sort of API breakage is a disgrace, re-inventing an existing API rather than extending it was a bad idea, but this level of incompetence beggars belief. Yes, you Ubuntu.


Some values collected:

All Ubuntu versions tested had /etc/lsb-release... maybe this can be used to discriminate early? etc..


Sat, 26 Nov 2011 11:40:22 GMT - Antoine Martin: status changed; resolution set

r310 fixes this: we only enable the "appindicator" crap on Ubuntu 11.10 and later.


Tue, 29 Nov 2011 08:16:02 GMT - pmarek:

Still doesn't work for me with 0.7.31 -- debian unstable, x86_64.


Tue, 29 Nov 2011 08:23:01 GMT - pmarek:

I don't think this will help ...

$ lsb_release  -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux testing (wheezy)
Release:        testing
Codename:       wheezy

Perhaps this is better?

$ qdbus  org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.GetServerInformation
Plasma
KDE
1.0
1.1

Or just make it configurable which one to use ...

Putting return False in setup_appindicator doesn't help, either.


Tue, 29 Nov 2011 09:20:52 GMT - Antoine Martin: attachment set

wheezy + gnome3 showing the tray with icons


Tue, 29 Nov 2011 09:21:04 GMT - Antoine Martin: attachment set

wheezy + kde plasma


Tue, 29 Nov 2011 09:21:15 GMT - Antoine Martin: attachment set

wheezy + lxde


Tue, 29 Nov 2011 09:31:09 GMT - Antoine Martin: attachment set

wheezy + xfce


Tue, 29 Nov 2011 09:32:51 GMT - Antoine Martin:

As can be seen in the 4 screenshots above, a fresh default installation of wheezy works just fine with all desktop environments tested.

Maybe you have an old version of the package files still installed? To allow me to reproduce, please create a brand new user and specify which desktop environment to use, and any other details that might be relevant.

btw, notifications and tray icons are different things, only loosely related


Wed, 30 Nov 2011 16:41:34 GMT - Doug Doole:

I'm using r313 under kubuntu 11.04 and I am still not seeing tray icons.


Wed, 30 Nov 2011 18:11:12 GMT - Antoine Martin: attachment set

kde plasma login


Wed, 30 Nov 2011 18:12:00 GMT - Antoine Martin: attachment set

kdeplasma shows tray icon


Wed, 30 Nov 2011 18:17:48 GMT - Antoine Martin:

I have just tried again with a brand new user created for the occasion, also tested both KDE/plasma and KDE/openbox session types. The tray icon is there every time, and so are the icons in the tray menu. Screenshots included.

If you want me to be able to fix this, you are going to have to give me steps to reproduce, as this is a brand new / clean install of Kubuntu 11.04 done for the occasion and it works just fine... I cannot fix something that I cannot see. You should probably try with a new user first to rule out user settings, then do a clean install of Kubuntu in a virtual machine like I did to rule out installation problems.


Wed, 30 Nov 2011 18:45:03 GMT - Doug Doole:

Ah, I figured out what's wrong - xpra is looking in the wrong place for the icons on my system.

I changed get_tray_icon_filename() to print the path being used, and it showed:

/opt/xpra/xpra-r313/install/lib/python/xpra/xposix/icons/xpra.png

which is odd because there is no icons directory under the xposix directory.

When I created a link from .../xposix/icons to /opt/xpra/share/xpra/icons and restarted the client, everything was working properly.

So, do I have my machine set up incorrectly? I extract everything to /opt/xpra/xpra-xxxx and build under that directory. For whatever build I am using, I link bin, share, and lib in /opt/xpra to /opt/xpra/xpra-xxxx/install. That is:

doole@andammo:/opt/xpra$ ls -l
lrwxrwxrwx  1 doole doole   21 2011-11-30 11:35 bin -> xpra-r313/install/bin
lrwxrwxrwx  1 doole doole   21 2011-11-30 11:35 lib -> xpra-r313/install/lib
lrwxrwxrwx  1 doole doole   23 2011-11-30 11:35 share -> xpra-r313/install/share
drwxr-xr-x 10 doole doole 4096 2011-11-03 14:58 xpra-0.0.7.30
drwxr-xr-x 10 doole doole 4096 2011-11-25 10:55 xpra-r305
drwxr-xr-x 10 doole doole 4096 2011-11-30 11:35 xpra-r313

To run xpra, I do:

export PYTHONPATH=/opt/xpra/lib/python
/opt/xpra/bin/xpra

Is there something I should be doing differently?


Wed, 30 Nov 2011 20:47:37 GMT - Doug Doole:

Ah, another insight. The path seems to be sensitive to whatever directory I issue the xpra command from. When I restarted the client just now, I was in my home directory and the reported icon path was /home/doole/icons/.

So it seems that, in my environment at least, xpra is looking in $PWD/icons.


Thu, 01 Dec 2011 07:14:07 GMT - Antoine Martin:

I have no idea how/why you ended up using this sort of path for installation, please refer to the build instructions on this page and it should just work.


Thu, 01 Dec 2011 14:16:22 GMT - Doug Doole:

I don't have root access on all the machines that I use, so I can't do the formal install.

I'm therefore compiling just for myself using the do-build script (as mentioned on that page). I don't want to have to change my PATH and PYTHONPATH every time I pull down a new version of xpra, so I link the bin, lib, and share directories into the /opt/xpra directory so I have a consistent location.


Thu, 01 Dec 2011 21:55:15 GMT - Doug Doole:

Here's a change that worked for me. In xposix/gui.py, I changed get_data_dir() as follows:

Removed:

return os.getcwd()

Added:

# Otherwise assume we've got a local install (from do-build)
return os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "../share/xpra"))

Fri, 02 Dec 2011 09:48:09 GMT - Antoine Martin:

merged with a path test in r324 to avoid breaking other platforms: the win32 build in the installer relies on os.getcwd() to find the icons.

Thanks!


Fri, 02 Dec 2011 14:31:46 GMT - Doug Doole:

r324 works for me. Thanks.


Mon, 20 Feb 2012 19:40:00 GMT - Antoine Martin: version, milestone set


Sun, 26 Feb 2012 11:21:11 GMT - mgiammarco: status changed; cc set; resolution deleted

Are you sure that the bug is fixed? I have installed your ppa package into ubuntu unity 11.10, kubuntu 11.10, and an old ubuntu 10.04 (with gnome2) and I can see the icon only on the last one.


Mon, 27 Feb 2012 10:36:22 GMT - Antoine Martin:

Just verified again in a virtual machine and both unity 11.10 and kubuntu worked fine. See screenshots.

Are you sure that the user you are running as is the same as your desktop session? (ie: not trying to run as root for example) If not, you will get some warnings like these:

libappindicator-WARNING **: Unable to send signal for NewStatus: The connection is closed

When running with: xpra -d all attach ..., you can see near the top of the debug messages:

...
detected Ubuntu release [11, 10]
get_tray_icon_filename using default: /usr/bin/../share/xpra/icons/xpra.png
...

And this file exists and is installed by the packages.

If this does not help, please post the full command lines you are using and client debug log.


Mon, 27 Feb 2012 10:37:03 GMT - Antoine Martin: attachment set

Ubuntu 11.10 + KDE showing the tray icon


Mon, 27 Feb 2012 10:37:20 GMT - Antoine Martin: attachment set

Ubuntu 11.10 + Unity showing the tray icon


Mon, 27 Feb 2012 19:49:45 GMT - mgiammarco:

Sorry I hope I have not make a mistake, but I am talking about winswitch_applet and not xpra. Am I right?


Mon, 27 Feb 2012 20:02:52 GMT - Antoine Martin: status changed; resolution set

ahhhhhh, this is Xpra's bug tracker, winswitch's is here...


Mon, 27 Feb 2012 20:05:56 GMT - Antoine Martin:

New ticket: https://winswitch.org/trac/ticket/193


Thu, 21 Feb 2019 13:36:57 GMT - Antoine Martin:

See also #406, #2161


Sat, 23 Jan 2021 04:44:00 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/43