Skip to content

Commit f66543e

Browse files
committed
chore: focus window the electron way
1 parent b0b1f0f commit f66543e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src-electron/main-window-ipc.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ function registerWindowIpcHandlers() {
8383
app.exit(exitCode || 0);
8484
});
8585

86-
// Focus current window
86+
// Focus current window and bring to front
8787
ipcMain.handle('focus-window', (event) => {
8888
const win = BrowserWindow.fromWebContents(event.sender);
8989
if (win) {
90-
win.setAlwaysOnTop(true);
90+
if (win.isMinimized()) {
91+
win.restore();
92+
}
93+
win.moveTop();
94+
win.show();
9195
win.focus();
92-
win.setAlwaysOnTop(false);
9396
}
9497
});
9598
}

0 commit comments

Comments
 (0)