Skip to content

Commit

Permalink
[NEW] Adds extra validation on minimizing or restoring the window (Ro…
Browse files Browse the repository at this point in the history
…cketChat#544)

* Adds extra option to trigger change in tray icon

When minimizing/restoring the window it doesn't fire the "open/close" events,
so if you minimize it and right-click the tray icon you will see "Hide" option,
clicking it won't change anything as the window is already hidden

* Removes console.log

* On clicking and window visible, should close it

if window is visible left-click should hide it
  • Loading branch information
vcapretz authored and gdelavald committed Sep 22, 2017
1 parent aa9cd3f commit 53e2eea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scripts/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ function createAppTray () {
};

mainWindow.on('show', onShow);
mainWindow.on('restore', onShow);

mainWindow.on('hide', onHide);
mainWindow.on('minimize', onHide);

_tray.setToolTip(remote.app.getName());

Expand All @@ -78,6 +81,10 @@ function createAppTray () {
});

_tray.on('click', () => {
if (mainWindow.isVisible()) {
return mainWindow.hide();
}

mainWindow.show();
});

Expand Down

0 comments on commit 53e2eea

Please sign in to comment.