This commit is contained in:
Ben Gotow 2018-05-22 13:29:14 -07:00
commit 86734a54f1
3 changed files with 25 additions and 3 deletions

View file

@ -78,7 +78,13 @@ class SystemTrayManager {
_onClick = () => {
if (this._platform !== 'darwin') {
this._application.emit('application:show-main-window');
if(this._application.windowManager.getVisibleWindowCount() == 0) {
this._application.emit('application:show-main-window');
}
else {
const visibleWindows = this._application.windowManager.getVisibleWindows();
visibleWindows.forEach(window => window.hide());
}
}
};

View file

@ -56,6 +56,22 @@ export default class WindowManager {
return this.getOpenWindows().length;
}
getVisibleWindows() {
const values = [];
Object.keys(this._windows).forEach(key => {
const win = this._windows[key];
if (win.isVisible()) {
values.push(win);
}
});
return values;
}
getVisibleWindowCount() {
return this.getVisibleWindows().length;
}
getAllWindowDimensions() {
const dims = {};
Object.keys(this._windows).forEach(key => {

View file

@ -447,8 +447,8 @@ class AttachmentStore extends MailspringStore {
const stats = await this._getFileStats(filePath);
if (stats.isDirectory()) {
throw new Error(`${filename} is a directory. Try compressing it and attaching it again.`);
} else if (stats.size > 15 * 1000000) {
throw new Error(`${filename} cannot be attached because it is larger than 5MB.`);
} else if (stats.size > 25 * 1000000) {
throw new Error(`${filename} cannot be attached because it is larger than 25MB.`);
}
const file = new File({