Replace generic "Open mattermost" by a menu entry for each team.
This commit is contained in:
parent
47f1f0cd8a
commit
81b40c68b3
|
@ -31,6 +31,7 @@
|
|||
- Ctrl+{1-9} (Window -> *Team name*): Open the *n*-th tab.
|
||||
- Ctrl+Tab or Alt+Command+Right (Window -> Select Next Team): Open the right tab.
|
||||
- Ctrl+Shift+Tab or Alt+Command+Left (Window -> Select Previous Team): Open the left tab.
|
||||
- Right click on the tray item, to see an overview of all your teams. You can also select one and jump right into it.
|
||||
- Added **Add** button next to the "Teams" label on the Setting page.
|
||||
- Added **Edit** button on the team list on the Setting page.
|
||||
- Added **Help** menu to indicate the application version.
|
||||
|
|
27
src/main.js
27
src/main.js
|
@ -364,23 +364,22 @@ app.on('ready', function() {
|
|||
ipcMain.on('update-menu', (event, config) => {
|
||||
var app_menu = appMenu.createMenu(mainWindow, config);
|
||||
Menu.setApplicationMenu(app_menu);
|
||||
// set up context menu for tray icon
|
||||
if (shouldShowTrayIcon()) {
|
||||
const tray_menu = require('./main/menus/tray').createMenu(mainWindow, config);
|
||||
trayIcon.setContextMenu(tray_menu);
|
||||
if (process.platform === 'darwin') {
|
||||
// store the information, if the tray was initialized, for checking in the settings, if the application
|
||||
// was restarted after setting "Show icon on menu bar"
|
||||
if (trayIcon)
|
||||
mainWindow.trayWasVisible = true;
|
||||
else
|
||||
mainWindow.trayWasVisible = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
ipcMain.emit('update-menu', true, config);
|
||||
|
||||
// set up context menu for tray icon
|
||||
if (shouldShowTrayIcon()) {
|
||||
const tray_menu = require('./main/menus/tray').createDefault(mainWindow);
|
||||
trayIcon.setContextMenu(tray_menu);
|
||||
if (process.platform === 'darwin') {
|
||||
// store the information, if the tray was initialized, for checking in the settings, if the application
|
||||
// was restarted after setting "Show icon on menu bar"
|
||||
if (trayIcon)
|
||||
mainWindow.trayWasVisible = true;
|
||||
else
|
||||
mainWindow.trayWasVisible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Open the DevTools.
|
||||
// mainWindow.openDevTools();
|
||||
|
||||
|
|
|
@ -6,28 +6,39 @@ const {
|
|||
MenuItem
|
||||
} = require('electron');
|
||||
|
||||
function createDefault(mainWindow) {
|
||||
return Menu.buildFromTemplate([{
|
||||
label: `Open ${app.getName()}`,
|
||||
click: () => {
|
||||
mainWindow.show();
|
||||
mainWindow.isHidden = false;
|
||||
function createTemplate(mainWindow, config) {
|
||||
var template = [
|
||||
...config.teams.slice(0, 9).map((team, i) => {
|
||||
return {
|
||||
label: team.name,
|
||||
accelerator: `CmdOrCtrl+${i + 1}`,
|
||||
click: (item, focusedWindow) => {
|
||||
mainWindow.show(); // for OS X
|
||||
mainWindow.webContents.send('switch-tab', i);
|
||||
mainWindow.isHidden = false;
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.show();
|
||||
mainWindow.focus();
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.show();
|
||||
mainWindow.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
}), {
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Quit',
|
||||
click: function(item) {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Quit',
|
||||
click: function(item) {
|
||||
app.quit();
|
||||
}
|
||||
}]);
|
||||
];
|
||||
return template;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createDefault: createDefault
|
||||
var createMenu = function(mainWindow, config) {
|
||||
return Menu.buildFromTemplate(createTemplate(mainWindow, config));
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
createMenu: createMenu
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue