Skip to content

Commit

Permalink
Fixes: zulip#1077
Browse files Browse the repository at this point in the history
Signed-off-by: tarun8718 <tarunkumar8718@gmail.com>
  • Loading branch information
tarun8718 committed Mar 2, 2021
1 parent 2a0f9b3 commit 9ccd1fe
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,21 @@ function getDarwinTpl(props: MenuProps): Electron.MenuItemConstructorOptions[] {
accelerator: 'Cmd+,',
click(_item, focusedWindow) {
if (focusedWindow) {
let numberServers = 0;
tabs.forEach(tab => {
if (tab.role === 'server') {
numberServers++;
}
});
if (numberServers === 1) {
const value = ConfigUtil.getConfigItem('showSidebar');
if (!value) {
const newValue = !value;
focusedWindow.webContents.send('toggle-sidebar', newValue);
ConfigUtil.setConfigItem('showSidebar', newValue);
}
}

sendAction('open-settings');
}
}
Expand Down Expand Up @@ -476,6 +491,21 @@ function getOtherTpl(props: MenuProps): Electron.MenuItemConstructorOptions[] {
accelerator: 'Ctrl+,',
click(_item, focusedWindow) {
if (focusedWindow) {
let numberServers = 0;
tabs.forEach(tab => {
if (tab.role === 'server') {
numberServers++;
}
});
if (numberServers === 1) {
const value = ConfigUtil.getConfigItem('showSidebar');
if (!value) {
const newValue = !value;
focusedWindow.webContents.send('toggle-sidebar', newValue);
ConfigUtil.setConfigItem('showSidebar', newValue);
}
}

sendAction('open-settings');
}
}
Expand Down

0 comments on commit 9ccd1fe

Please sign in to comment.