Skip to content

Commit

Permalink
use getFocusedWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
goosewobbler committed Apr 10, 2023
1 parent 4e92de3 commit 039599a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 3 additions & 6 deletions main/windows/dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export const showUnhandledExceptionDialog = (message: string, code?: string) =>
}

export const openFileDialog = async () => {
try {
const file = await dialog.showOpenDialog(windows.browserWindows().dash, { properties: ['openFile'] })
return file
} catch (e) {
throw new Error((e as Error).message)
}
const browserWindow = BrowserWindow.getFocusedWindow() as BrowserWindow
const file = await dialog.showOpenDialog(browserWindow, { properties: ['openFile'] })
return file
}
3 changes: 0 additions & 3 deletions main/windows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,5 @@ export default {
min(e: IpcMainEvent) {
windowFromWebContents(e.sender).minimize()
},
browserWindows() {
return windows
},
init
}

0 comments on commit 039599a

Please sign in to comment.