Skip to content

Commit

Permalink
fix(macos): show window on dock click when using menu bar mode
Browse files Browse the repository at this point in the history
When "Show in menu bar" is enabled and the window is closed, clicking
the app icon in the dock now properly shows the window again instead
of only focusing it.
  • Loading branch information
heyman committed Jan 4, 2025
1 parent a4ca319 commit 82494d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,14 @@ app.on('second-instance', () => {
}
})

app.on('activate', () => {
app.on('activate', (event, hasVisibleWindows) => {
const allWindows = BrowserWindow.getAllWindows()
if (allWindows.length) {
allWindows[0].focus()
// show the window if it's hidden (e.g. the window was closed with "show in menu bar" setting turned on)
if (!allWindows[0].isVisible()) {
allWindows[0].show()
}
} else {
createWindow()
}
Expand Down

0 comments on commit 82494d8

Please sign in to comment.