Skip to content

Commit b636abb

Browse files
author
Warren Buckley
authored
Merge pull request #671 from ianleeder/fix-error-with-devtools
Get focused window instead of all
2 parents 263128d + e6d9f96 commit b636abb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

LogViewer.Client/src/main/events.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ ipcMain.on("logviewer.open-file-dialog", () => {
1515
ipcMain.on("logviewer.dragged-file", (event: Electron.IpcMainEvent, filePath: string) => {
1616

1717
// Get focused window
18-
const allWindows = webContents.getAllWebContents();
19-
const currentWindow = allWindows[0];
18+
const currentWindow = webContents.getFocusedWebContents();
2019

2120
// Disable the file open menu item & enable the close menu item
2221
updateMenuEnabledState("logviewer.open", false);
@@ -31,8 +30,7 @@ ipcMain.on("logviewer.dragged-file", (event: Electron.IpcMainEvent, filePath: st
3130
ipcMain.on("logviewer.get-logs", (event: Electron.IpcMainEvent, arg: any) => {
3231
// Get focused window
3332
console.log("get logs", arg);
34-
const allWindows = webContents.getAllWebContents();
35-
const currentWindow = allWindows[0];
33+
const currentWindow = webContents.getFocusedWebContents();
3634

3735
webapi.getLogs(currentWindow, arg.pageNumber, arg.filterExpression, arg.sortOrder);
3836

0 commit comments

Comments
 (0)