Mailspring/internal_packages/system-tray/lib/main.es6
Juan Tejada a6c44b8529 feat(system-tray): add system-tray package
Summary:
- Updates support for ES6 code inside packages
- Displays system tray icon with unread count on darwin, or with bubble on other platforms
- Uses canvas api to dynamically generate icon image given unread count:
  - Adds CavasUtils.canvasFromImgAndText to do this
- Adds config option to display system tray icon on darwin

Test Plan: Need to write the tests for this.

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2231
2015-11-06 11:12:38 -08:00

32 lines
669 B
JavaScript

import SystemTray from './system-tray';
const platform = process.platform;
let systemTray;
let unsubConfig;
const onSystemTrayToggle = (showSystemTray)=> {
if (showSystemTray.newValue) {
systemTray = new SystemTray(platform);
} else {
systemTray.destroy();
systemTray = null;
}
};
export function activate() {
unsubConfig = atom.config.onDidChange('core.showSystemTray', onSystemTrayToggle);
if (atom.config.get('core.showSystemTray')) {
systemTray = new SystemTray(platform);
}
}
export function deactivate() {
if (systemTray) {
systemTray.destroy();
systemTray = null;
}
unsubConfig();
}
export function serialize() {
}