Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tray does not appears on Linux #1347

Closed
remss opened this issue Apr 2, 2015 · 12 comments
Closed

Tray does not appears on Linux #1347

remss opened this issue Apr 2, 2015 · 12 comments

Comments

@remss
Copy link

remss commented Apr 2, 2015

The tray example does not work on Linux. The tray is not shown.
Tested with atom-shell 0.22.3 + Ubuntu 14 and atom-shell 0.22.3 + Debian Jessi

var app = require('app');
var Menu = require('menu');
var Tray = require('tray');

var appIcon = null;

app.on('ready', function(){
  appIcon = new Tray('icon.png');
  var contextMenu = Menu.buildFromTemplate([
    { label: 'Item1', type: 'radio' },
    { label: 'Item2', type: 'radio' },
    { label: 'Item3', type: 'radio', checked: true },
    { label: 'Item4', type: 'radio' },
  ]);
  appIcon.setToolTip('This is my application.');
  appIcon.setContextMenu(contextMenu);
});
@anaisbetts
Copy link
Contributor

Tray has been working for us, though whether the tray icon actually shows up is super distro-specific (some distros don't allow tray icons at all)

@remss
Copy link
Author

remss commented Apr 6, 2015

I agree that it is distro specific, but atom-shell doc says that Tray is supported on Linux with AppIndicator or GTK => https://github.com/atom/atom-shell/blob/master/docs/api/tray.md
So i think this is a bug because both Ubutu 14 and Debian Jessi use AppIndicator.

@zcbenz
Copy link
Contributor

zcbenz commented Apr 8, 2015

Yeah it supports app indicator, and it used to work on Ubuntu 14.04, it seems to be a regression.

@davej
Copy link
Contributor

davej commented May 13, 2015

Can confirm, also experiencing this issue on Ubuntu 14.04.

@sergiopvilar
Copy link

I'm having this issue in Electron 0.29.2

@alexandrkazah
Copy link

I'm having an issue in Electron 0.29.1 when trying to initialise tray, give me following error "A JavaScript error occured in the browser process
Uncaught Exception:
TypeError: Error processing argument 0.
at TypeError (native)
at EventEmitter. (/Users/xxxxxxx/xxxxxxx/first-electron-app/main.js:34:13)
at emitOne (events.js:82:20)
at EventEmitter.emit (events.js:169:7)"
Line 34 in "main.js" is the initialisation line. Here it is ("appIcon = new Tray('file://' + __dirname + '/tree.png');"
Any help would be much appreciated.

@alexandrkazah
Copy link

Found the problem I had. When creating a new Tray it does not recognise the path I put in the argument. I had to use 'path' module to load the location of the image for the icon.
I.e.: var iconIdle = path.join(__dirname, 'images', 'tree.png');
appIcon = new Tray(iconIdle);
Then it works.

@sergiopvilar
Copy link

I need to install libappindicator1 to get the tray working, is that right?

@alexandrkazah
Copy link

sergiovilar, no you do not need it at all, only "tray".

@sergiopvilar
Copy link

@alexandrkazah unfortunately I had to install libappindicator1 on Ubuntu 14.04+ to get the Tray working.

@zcbenz
Copy link
Contributor

zcbenz commented Jul 21, 2015

@sergiovilar Yeah the libappindicator1 has to be installed to make Tray working on Ubuntu, thanks for finding it out!

@zcbenz zcbenz closed this as completed in 59269a7 Jul 21, 2015
@sergiopvilar
Copy link

@zcbenz any clue to get the Tray working on Debian 8? The Tray doesn't appear even with libappindicator1 installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants