Ubuntu – Dropbox AppIndicator Menu broken in gnome-flashback

dropboxgnome-classicindicatorsystem-tray

The problem

Broken Dropbox Menu as appindicator in gnome-flashback

This is a broken Dropbox indicator in gnome-flashback on Ubuntu 16.04.1. (Dropbox version: x86_64-9.4.94)

Working Dropbox Menu in Unity

As it can be seen here, it works fine in Unity. But how can I get that in gnome-flashback (as appindicator)?

The workaround

enter image description here

When I force Dropbox to present itself as old-fashioned systray icon1 the menu gets usable.

Open questions

  • What convinces Dropbox to present the color icon in gnome-flashback when it runs as appindicator? As indicator it is black&white in Unity.
  • Can I fool Dropbox to believe it runs under Unity? Can I force "appindicator mode"?
  • Is there something wrong in the Dropbox code failing to decide properly between systray/appindicator? This colored icon looks like the result of half systray, half appindicator…


1 You can force Dropbox into "systray mode" by running dbus-launch dropbox start or DBUS_SESSION_BUS_ADDRESS= dropbox start instead of starting it with a plain dropbox start.

Best Answer

Can I fool Dropbox to believe it runs under Unity? Can I force "appindicator mode"?

Yes, you can! Experiments show that Dropbox (or related) looks for the environment variable XDG_CURRENT_DESKTOP, a freedesktop.org standard thing reflecting the name of the Desktop Environment in use. Set it to Unity and Dropbox turns sane. (I tried other sensible values, but the results were worse.)

There will be several ways to plant that variable on Dropbox. I chose to edit the command line interface script /usr/bin/dropbox from the nautilus-dropbox package to always overwrite this variable. Add this line after the imports. It will also work for "Start Dropbox on system startup":

os.environ['XDG_CURRENT_DESKTOP'] = 'Unity'
Related Question