Improved window state handling

Closes #249
This commit is contained in:
Kolja Lampe 2016-08-16 23:12:41 +02:00
parent e514d87fc5
commit 7429df05f5
4 changed files with 23 additions and 8 deletions

View file

@ -14,9 +14,6 @@ Release date: TBD
- Disabled `eval()` function for security improvements.
- Invalidate cache before load, to make server upgrades easy
#### Windows
- Update Mattermost icon for desktop notifications in Windows 10.
#### Linux (Beta)
- Added an option to make the taskbar icon flash on new messages
- Added the badge to count mentions for Unity.
@ -25,11 +22,12 @@ Release date: TBD
- Added an option to toggle the red dot icon for unread messages (default is on).
#### Windows
- Update Mattermost icon for desktop notifications in Windows 10.
- Added an option to toogle the red dot icon for unread messages (default is on).
### 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

@ -242,8 +242,13 @@ app.on('ready', function() {
trayIcon.setToolTip(app.getName());
trayIcon.on('click', function() {
if (!mainWindow.isVisible() || mainWindow.isMinimized()) {
if (!mainWindow.isVisible()) {
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
else {
mainWindow.show();
}
mainWindow.focus();
if (process.platform === 'darwin') {
app.dock.show();
@ -262,7 +267,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

@ -13,7 +13,12 @@ function createTemplate(mainWindow, config) {
label: team.name,
accelerator: `CmdOrCtrl+${i + 1}`,
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') {