Merge pull request #6627 from davej/patch-1
docs: Explain how to use highlightMode with BrowserWindow
This commit is contained in:
commit
34f33c3b45
1 changed files with 21 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue