Merge pull request #251 from Razzeee/fix-window-state

Improved window state handling
This commit is contained in:
Yuya Ochiai
2016-08-22 22:39:29 +09:00
4 changed files with 23 additions and 4 deletions

View File

@@ -34,6 +34,8 @@ Release date: TBD
### Bug Fixes
- Fixed an issue where the maximized state of the app window was lost in some cases.
## Release v1.3.0

View File

@@ -117,10 +117,16 @@ notification.override({
if (currentWindow.isVisible()) {
currentWindow.focus();
}
else if (currentWindow.isMinimized()) {
currentWindow.restore();
}
else {
currentWindow.show();
}
}
else if (currentWindow.isMinimized()) {
currentWindow.restore();
}
else {
currentWindow.show();
}

View File

@@ -258,8 +258,13 @@ app.on('ready', function() {
trayIcon.setToolTip(app.getName());
trayIcon.on('click', function() {
if (!mainWindow.isVisible() || mainWindow.isMinimized()) {
mainWindow.show();
if (!mainWindow.isVisible()) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
else {
mainWindow.show();
}
mainWindow.focus();
if (process.platform === 'darwin') {
app.dock.show();
@@ -278,7 +283,8 @@ app.on('ready', function() {
});
trayIcon.on('balloon-click', function() {
if (process.platform === 'win32' || process.platform === 'darwin') {
mainWindow.show();
if (mainWindow.isMinimized()) mainWindow.restore()
else mainWindow.show();
}
if (process.platform === 'darwin') {

View File

@@ -12,7 +12,12 @@ function createTemplate(mainWindow, config) {
return {
label: team.name,
click: (item, focusedWindow) => {
mainWindow.show(); // for OS X
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
else {
mainWindow.show();
}
mainWindow.webContents.send('switch-tab', i);
if (process.platform === 'darwin') {