mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Listening to shortcut only when window is focused
This commit is contained in:
parent
4d59f57a68
commit
e9e7e338fb
@ -69,21 +69,26 @@ const createWindow = async () => {
|
||||
mainWindow?.webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
// Dev tools
|
||||
globalShortcut.register('Ctrl+Shift+I', function () {
|
||||
if (mainWindow?.webContents.isDevToolsOpened()) {
|
||||
mainWindow?.webContents.closeDevTools()
|
||||
} else {
|
||||
mainWindow?.webContents.openDevTools()
|
||||
}
|
||||
|
||||
mainWindow.on('focus', function () {
|
||||
// Dev tools
|
||||
globalShortcut.register('Ctrl+Shift+I', function () {
|
||||
if (mainWindow?.webContents.isDevToolsOpened()) {
|
||||
mainWindow?.webContents.closeDevTools()
|
||||
} else {
|
||||
mainWindow?.webContents.openDevTools()
|
||||
}
|
||||
});
|
||||
// Refresh
|
||||
globalShortcut.register('Ctrl+R', function () {
|
||||
mainWindow?.reload()
|
||||
});
|
||||
globalShortcut.register('Ctrl+Shift+R', function () {
|
||||
mainWindow?.reload()
|
||||
});
|
||||
});
|
||||
// Refresh
|
||||
globalShortcut.register('Ctrl+R', function () {
|
||||
mainWindow?.reload()
|
||||
});
|
||||
globalShortcut.register('Ctrl+Shift+R', function () {
|
||||
mainWindow?.reload()
|
||||
mainWindow.on('blur', function () {
|
||||
globalShortcut.unregisterAll()
|
||||
});
|
||||
|
||||
// Minimize, maximize, close window.
|
||||
@ -103,6 +108,7 @@ const createWindow = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// No DPI scaling
|
||||
app.commandLine.appendSwitch('high-dpi-support', '1');
|
||||
app.commandLine.appendSwitch('force-device-scale-factor', '1');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user