mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-27 11:39:31 +08:00
fix #448
This commit is contained in:
parent
6315ec12ae
commit
fbc7da0606
@ -110,10 +110,15 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
|
||||
// mainWindow.show();
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+W', () => {
|
||||
if (mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused()) {
|
||||
// 添加局部快捷键监听
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.key.toLowerCase() === 'w'
|
||||
&& (input.control || input.meta) && !input.alt && !input.shift) {
|
||||
event.preventDefault();
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 注册自定义全局快捷键
|
||||
|
Loading…
x
Reference in New Issue
Block a user