diff --git a/internal_packages/system-tray/lib/main.es6 b/internal_packages/system-tray/lib/main.es6 index 4ae4f79c0..29dc2f2df 100644 --- a/internal_packages/system-tray/lib/main.es6 +++ b/internal_packages/system-tray/lib/main.es6 @@ -2,7 +2,7 @@ import SystemTray from './system-tray'; const platform = process.platform; let systemTray; -let unsubConfig; +let unsubConfig = ()=>{}; const onSystemTrayToggle = (showSystemTray)=> { if (showSystemTray.newValue) { systemTray = new SystemTray(platform); @@ -12,13 +12,6 @@ const onSystemTrayToggle = (showSystemTray)=> { } }; -export function activate() { - unsubConfig = NylasEnv.config.onDidChange('core.showSystemTray', onSystemTrayToggle).dispose; - if (NylasEnv.config.get('core.showSystemTray')) { - systemTray = new SystemTray(platform); - } -} - export function deactivate() { if (systemTray) { systemTray.destroy(); @@ -27,6 +20,14 @@ export function deactivate() { 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() { }