electron: [Bug]: Tray icon missing on Ubuntu Unity 22.04 & 23.04 etc.

Preflight Checklist

Electron Version

17.0.0

What operating system are you using?

Ubuntu

Operating System Version

Ubuntu Unity 22.04 and 23.04

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Tray icon should show for latest apps using Electron, like Slack, Signal and Discord.

Actual Behavior

Tray icon not shown for latest apps using Electron, like Slack, Signal and Discord.

Testcase Gist URL

No response

Additional Information

Currently, Unity7 in Ubuntu Unity 22.04 / 23.04:

$ echo $XDG_CURRENT_DESKTOP
Unity:Unity7:ubuntu

as a workaround, apps using Electron need to be started with XDG_CURRENT_DESKTOP=Unity7 or XDG_CURRENT_DESKTOP="" (unset) for the tray icon to show in Unity7 in Ubuntu. example: $ XDG_CURRENT_DESKTOP=Unity7 slack

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 24 (2 by maintainers)

Most upvoted comments

I ran into this issue as well and had a bit of a dig around.

I tested it with an Electron 24.6.2 app (teams-for-linux) on Ubuntu Unity 23.04. Paradoxically the tray icons seem to work whenever XDG_CURRENT_DESKTOP is set to a value that Electron does not recognise as Unity.

In file lib/browser/init.ts, there is the function currentPlatformSupportsAppIndicator() If it returns true, XDG_CURRENT_DESKTOP is set to “Unity”.

if (currentPlatformSupportsAppIndicator()) {
  process.env.XDG_CURRENT_DESKTOP = 'Unity';
}

Looking at the implementation of currentPlatformSupportsAppIndicator(), it returns true in the following cases:

  • The value of XDG_CURRENT_DESKTOP is one of ‘Pantheon’, ‘Unity:Unity7’, ‘pop:GNOME’.
  • The vaue of XDG_CURRENT_DESKTOP contains the substring “ubuntu”.

Thus, the following launch commands are examples that fail to show the tray icon:

  • XDG_CURRENT_DESKTOP='Unity:Unity7:ubuntu' teams-for-linux
  • XDG_CURRENT_DESKTOP='Unity' teams-for-linux
  • XDG_CURRENT_DESKTOP='ubuntu' teams-for-linux

Thus, the following launch commands are examples that succeed to show the tray icon:

  • XDG_CURRENT_DESKTOP='' teams-for-linux
  • XDG_CURRENT_DESKTOP='sadfasdfasdfa' teams-for-linux

Ubuntu Unity 23.04 uses the value XDG_CURRENT_DESKTOP='Unity:Unity7:ubuntu' which is amongst the failing examples.

Bump

bump

still happening

Can confirm that @kaymes workaround works me using discord on Ubuntu 22.04 with Unity as desktop environment

My mistake… It actually affects latest version of slack-desktop debian package installed on Ubuntu Unity 23.04 which is:

t@creator:~$ dpkg -l slack-desktop | tail -1
ii  slack-desktop  4.32.127     amd64        Slack Desktop

t@creator:~$ strings /usr/bin/slack | grep '^Chrome/[0-9.]* Electron/[0-9]'
Chrome/112.0.5615.165 Electron/24.2.0

So, at least I demonstrate it affects Electron/24.2.0

It was also reported to also affect latest versions of Signal and Discord apps on Ubuntu Unity 22.04. I will try to also demonstrate the Electron versions used with these two apps.