I have been hearing about a lot of problems from people not being able to access the tray icons of some of their apps/background processes on Ubuntu after they upgraded to the recent Ubuntu 17.10, that uses GNOME as its default desktop environment. Well, the first fix is to just choose Unity while logging in or if you still prefer the new GNOME UI, like me, you might have to do a little bit of work to make it happen. Not a lot of it, I promise.
So why is this happening?
If you go to your terminal and type the following:
It prints “ubuntu:GNOME” and this is what the problem is. You see, previously, that is before Ubuntu 17.10, this environment variable used to print “Unity” (or “Unity7” in some cases) as its value and some programs started to rely on this fact. So we will do the same. We will enforce our programs to run with XDG_CURRENT_DESKTOP=Unity
Suppose we have our very favorite app named “foobar” that is now unable to show its tray icon. All we have to do is write a stupid little shell script that has the content:
That’s one part done. The second part is to find the respective .desktop file for your app and replace the existing “EXEC” line with something like “EXEC=~/path/to/foobar_run.sh”. You can find the .desktop file in either ~/.local/share/applications/ or /usr/share/applications/. Once you have done this, restart your computer and if everything is alright, then voila! Your tray icon is back!
Note that if your process already uses a shell script to run, all you need to do is place the export statement from the above shell script (foobar_run.sh) at the top of the shell script that is used to execute the program.
Hope this helps! 😁