move dock state to renderer process

This commit is contained in:
Feross Aboukhadijeh
2016-03-03 16:44:19 -08:00
parent a188b6caaf
commit 68824b40dd
2 changed files with 35 additions and 24 deletions

View File

@@ -35,10 +35,6 @@ app.on('activate', function () {
}
})
app.on('browser-window-focus', function () {
setBadge('')
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
@@ -133,11 +129,7 @@ function setAspectRatio (aspectRatio, extraSize) {
// Display string in dock badging area (OS X)
function setBadge (text) {
debug('setBadge %s', text)
if (mainWindow && !mainWindow.isFocused()) {
if (text === '+') {
// special value to increment the badge number
text = (Number(app.dock.getBadge()) || 0) + 1
}
if (mainWindow) {
app.dock.setBadge(String(text))
}
}