docs: Add click handler to tray window example
This commit is contained in:
parent
322fe36dea
commit
42640b6170
1 changed files with 4 additions and 0 deletions
|
@ -202,6 +202,10 @@ const {BrowserWindow, Tray} = require('electron')
|
|||
|
||||
const win = new BrowserWindow({width: 800, height: 600})
|
||||
const tray = new Tray('/path/to/my/icon')
|
||||
|
||||
tray.on('click', () => {
|
||||
win.isVisible() ? win.hide() : win.show()
|
||||
})
|
||||
win.on('show', () => {
|
||||
tray.setHighlightMode('always')
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue