Show or restore if minimized
This commit is contained in:
@@ -12,12 +12,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
return {
|
return {
|
||||||
label: team.name,
|
label: team.name,
|
||||||
click: (item, focusedWindow) => {
|
click: (item, focusedWindow) => {
|
||||||
if (mainWindow.isMinimized()) {
|
showOrRestore(mainWindow);
|
||||||
mainWindow.restore();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mainWindow.show();
|
|
||||||
}
|
|
||||||
mainWindow.webContents.send('switch-tab', i);
|
mainWindow.webContents.send('switch-tab', i);
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
@@ -32,7 +27,7 @@ function createTemplate(mainWindow, config) {
|
|||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
click: () => {
|
click: () => {
|
||||||
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
mainWindow.loadURL('file://' + __dirname + '/browser/settings.html');
|
||||||
mainWindow.show();
|
showOrRestore(mainWindow);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
@@ -47,6 +42,10 @@ var createMenu = function(mainWindow, config) {
|
|||||||
return Menu.buildFromTemplate(createTemplate(mainWindow, config));
|
return Menu.buildFromTemplate(createTemplate(mainWindow, config));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function showOrRestore(window) {
|
||||||
|
window.isMinimized() ? window.restore() : window.show()
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createMenu: createMenu
|
createMenu: createMenu
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user