🍓A progress indicator in tray for your Electron app.
MIT License
A progress indicator in tray for your Electron app.
$ npm install electron-tray-indicator --save
Working with a determinate progress:
import { Tray } from 'electron'
import { progress, clean } from 'electron-tray-indicator'
function start(tray: Tray) {
let p = 0
const tick = () => {
progress({
tray: tray,
progress: p,
})
p += 0.5
if (p < 100) {
setTimeout(tick, 16)
} else {
// update the tray with your `img`
tray.setImage(img)
// clean the background resources (a hidden window)
clean()
}
}
tick()
}
start()
Working with an indeterminate progress:
import { Tray } from 'electron'
import { indeterminate, clean } from 'electron-tray-indicator'
const stop = indeterminate({
tray,
})
// just call `stop` when some task finished
stop()
// then update the tray with your `img`
tray.setImage(img)
// finally you can call `clean` to release the background resources
clean()
Find more examples see the ./examples.
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.