mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
cc536c1268
- Makes sure the tray is deactivated before activating
33 lines
710 B
JavaScript
33 lines
710 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 deactivate() {
|
|
if (systemTray) {
|
|
systemTray.destroy();
|
|
systemTray = null;
|
|
}
|
|
unsubConfig();
|
|
}
|
|
|
|
export function activate() {
|
|
deactivate();
|
|
unsubConfig = NylasEnv.config.onDidChange('core.showSystemTray', onSystemTrayToggle).dispose;
|
|
if (NylasEnv.config.get('core.showSystemTray')) {
|
|
systemTray = new SystemTray(platform);
|
|
}
|
|
}
|
|
|
|
export function serialize() {
|
|
|
|
}
|