fix: do not use globalShortcut for tab switching (#7827)

fix #7826
This commit is contained in:
pengx17
2024-08-11 07:56:46 +00:00
parent d82f4b5461
commit a6169ab26a
2 changed files with 26 additions and 22 deletions
@@ -10,6 +10,7 @@ import {
reloadView,
showDevTools,
showMainWindow,
switchTab,
undoCloseTab,
} from '../windows-manager';
import { applicationMenuSubjects } from './subject';
@@ -138,6 +139,22 @@ export function createApplicationMenu() {
undoCloseTab().catch(console.error);
},
},
{
label: 'Switch to tab',
acceleratorWorksWhenHidden: true,
visible: false,
submenu: [1, 2, 3, 4, 5, 6, 7, 8, 9].map(n => {
const shortcut = `CommandOrControl+${n}`;
const listener = () => {
switchTab(n);
};
return {
label: `Switch to tab ${n}`,
accelerator: shortcut,
click: listener,
};
}),
},
],
},
{