mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

--xpra: Tray icon not showing #181

Closed vincent-163 closed 5 years ago

vincent-163 commented 5 years ago

Running Docker 19.03.1 on Ubuntu 18.04.3 Desktop.

I ran some applications like Telegram with x11docker. The application's window showed up correctly and behaved normal, so I believe I got most things right. However, the application's tray icon did not show up. It should have shown on the top right corner of the screen, but instead there was a Xpra client icon with menu items like Information, Features, Disconnect, etc, and not the application's icon.

mviereck commented 5 years ago

You can try with option --hostdbus to allow DBus communication between container and host. That will probably allow the telegram tray icon. Note that this degrades container isolation.

EDIT: Looking at the xpra doku: It seems xpra should show application tray icons itself. I'll have a look why it does not.

vincent-163 commented 5 years ago

I tried --hostdbus but I didn't notice any difference. Also the problem applies to a variety of applications, not just Telegram.

vincent-163 commented 5 years ago

I tried using just Xpra and not x11docker and got the same bug, so I believe the bug is at xpra side rather than x11docker side. I found this ticket: https://xpra.org/trac/ticket/2161 which seems to be related, but I haven't found a workaround yet.

mviereck commented 5 years ago

I just tried xpra without x11docker, too, and get a different issue: A tray icon appears, but does not show its menu on mouse clicks. Tested with radiotray.

xpra start :22 --xvfb "/usr/bin/Xvfb :22" --daemon=no --start "radiotray"
xpra attach :22

Could you test this, too, and compare the behaviour? What is your xpra --version? Here it is xpra v3.0-r23575. What is your desktop environment? Here it is xfce.

vincent-163 commented 5 years ago

xpra --version is xpra v2.5.3-r23270 and desktop environment is GNOME3 (Ubuntu 18.04 default). I failed to run the same command because of error:

X11 extension Composite not available
Xpra 'start' subcommand runs as a compositing manager
it cannot use a display which lacks the XComposite extension!

I had to remove the --xvfb option, and the behavior is the same: the tray icon for xpra appears, but not the application.

vincent-163 commented 5 years ago

@mviereck I ran xpra start with the -d tray option to see what happened and got this:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/x11/gtk_x11/tray.py", line 196, in do_xpra_client_message_event
    self.dock_tray(xid)
  File "/usr/lib/python2.7/dist-packages/xpra/x11/gtk_x11/tray.py", line 221, in dock_tray
    window = x11_foreign_new(xid)
  File "/usr/lib/python2.7/dist-packages/xpra/gtk_common/gtk_util.py", line 456, in x11_foreign_new
    return gdk.window_foreign_new_for_display(xid)
TypeError: window_foreign_new_for_display() argument 1 must be gtk.gdk.Display, not int

It seems like the wrong API was called causing function signature mismatch. I found a similar method window_foreign_new with the expected signature and patched the source code to replace the function name, and the tray icon appeared. Then I ran into the same problem as you have described. The tray icon responds to mouse clicks, but is not able to pop a menu.

mviereck commented 5 years ago

It makes sense to open a ticket at www.xpra.org. Would you like do do it? Otherwise I'll do it the next days. Meanwhile you can try nxagent (option --nxagent). At least a test with radiotray seems to work so far.

EDIT: I've made a note about this issue at https://www.xpra.org/trac/ticket/2397#ticket

mviereck commented 5 years ago

I don't have xpra tray icon issues anymore with current beta xpra v3.0-r23672. You could consider to use the xpra/winswitch repository instead of the xpra version from the Ubuntu repository.

dark-penguin commented 4 years ago

No menus on right-clicking tray icons is a bug in Xpra: https://xpra.org/trac/ticket/2729