update(tray): Show 'Open Inbox' tray menu option and option to disable

tray  on Mac and Linux

- Resolves #673
- Resolves #762
- Resolves #594
This commit is contained in:
Juan Tejada 2015-12-20 21:30:41 -08:00
parent 57651300ac
commit de1f8d24d0
3 changed files with 7 additions and 6 deletions

View file

@ -11,6 +11,7 @@ class SystemTray {
this._tray = new Tray(this._store.icon()); this._tray = new Tray(this._store.icon());
this._tray.setToolTip(this._store.tooltip()); this._tray.setToolTip(this._store.tooltip());
// Check in case there is no menu for the current platform
const menu = this._store.menu(); const menu = this._store.menu();
if (menu != null) this._tray.setContextMenu(menu); if (menu != null) this._tray.setContextMenu(menu);

View file

@ -11,7 +11,7 @@ const {canvasWithSystemTrayIconAndText} = CanvasUtils;
const BASE_ICON_PATH = path.join(__dirname, '..', 'assets', process.platform, 'ic-systemtray-nylas.png'); const BASE_ICON_PATH = path.join(__dirname, '..', 'assets', process.platform, 'ic-systemtray-nylas.png');
const UNREAD_ICON_PATH = path.join(__dirname, '..', 'assets', process.platform, 'ic-systemtray-nylas-unread.png'); const UNREAD_ICON_PATH = path.join(__dirname, '..', 'assets', process.platform, 'ic-systemtray-nylas-unread.png');
const menuTemplate = [ const _menuTemplate = [
{ {
label: 'New Message', label: 'New Message',
click: ()=> ipcRenderer.send('command', 'application:new-message'), click: ()=> ipcRenderer.send('command', 'application:new-message'),
@ -29,15 +29,15 @@ const menuTemplate = [
}, },
]; ];
if (process.platform === 'darwin') { if (process.platform !== 'win32') {
menuTemplate.unshift({ _menuTemplate.unshift({
label: 'Open Inbox', label: 'Open Inbox',
click: ()=> ipcRenderer.send('command', 'application:show-main-window'), click: ()=> ipcRenderer.send('command', 'application:show-main-window'),
}); });
} }
const _buildMenu = ()=> { const _buildMenu = ()=> {
return Menu.buildFromTemplate(menuTemplate); return Menu.buildFromTemplate(_menuTemplate);
}; };
class TrayStore extends NylasStore { class TrayStore extends NylasStore {

View file

@ -12,8 +12,8 @@ module.exports =
systemTray: systemTray:
type: 'boolean' type: 'boolean'
default: true default: true
title: "Show icon in Mac OS X menu bar" title: "Show icon in menu bar"
platforms: ['darwin'] platforms: ['darwin', 'linux']
showImportant: showImportant:
type: 'boolean' type: 'boolean'
default: true default: true