Skip to content

Commit 74aa0dc

Browse files
author
Jessica Lord
committed
Merge pull request electron#210 from electron/remove-tray-on-quit
Remove tray icon when all windows are closed
2 parents a7cfa66 + e403935 commit 74aa0dc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main-process/native-ui/tray/tray.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22
const electron = require('electron')
33
const ipc = electron.ipcMain
4+
const app = electron.app
45

56
let appIcon = null
67

@@ -19,6 +20,10 @@ ipc.on('put-in-tray', function (event) {
1920
appIcon.setContextMenu(contextMenu)
2021
})
2122

22-
ipc.on('remove-tray', function (event) {
23+
ipc.on('remove-tray', function () {
24+
appIcon.destroy()
25+
})
26+
27+
app.on('window-all-closed', function () {
2328
appIcon.destroy()
2429
})

0 commit comments

Comments
 (0)