Merge pull request #6627 from davej/patch-1

docs: Explain how to use highlightMode with BrowserWindow
This commit is contained in:
Kevin Sawicki 2016-07-27 15:57:34 -07:00 committed by GitHub
commit 34f33c3b45

View file

@ -193,6 +193,27 @@ Sets the title displayed aside of the tray icon in the status bar.
Sets when the tray's icon background becomes highlighted (in blue). Sets when the tray's icon background becomes highlighted (in blue).
**Note:** You can use `highlightMode` with a [`BrowserWindow`](browser-window.md)
by toggling between `'never'` and `'always'` modes when the window visibility
changes.
```js
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')
})
win.on('hide', () => {
tray.setHighlightMode('never')
})
```
#### `tray.displayBalloon(options)` _Windows_ #### `tray.displayBalloon(options)` _Windows_
* `options` Object * `options` Object