We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6315ec1 commit fbc7da0Copy full SHA for fbc7da0
src/main/common/registerHotKey.ts
@@ -110,9 +110,14 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
110
// mainWindow.show();
111
});
112
113
- globalShortcut.register('CommandOrControl+W', () => {
114
- if (mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused()) {
115
- mainWindow.hide();
+ // 添加局部快捷键监听
+ mainWindow.webContents.on('before-input-event', (event, input) => {
+ if (input.key.toLowerCase() === 'w'
116
+ && (input.control || input.meta) && !input.alt && !input.shift) {
117
+ event.preventDefault();
118
+ if (mainWindow && !mainWindow.isDestroyed()) {
119
+ mainWindow.hide();
120
+ }
121
}
122
123
0 commit comments