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