Fix error on Windows caused by setBadge (#867)
This commit is contained in:
@@ -4,9 +4,7 @@ module.exports = {
|
|||||||
setBadge
|
setBadge
|
||||||
}
|
}
|
||||||
|
|
||||||
var electron = require('electron')
|
var {app, Menu} = require('electron')
|
||||||
|
|
||||||
var app = electron.app
|
|
||||||
|
|
||||||
var dialog = require('./dialog')
|
var dialog = require('./dialog')
|
||||||
var log = require('./log')
|
var log = require('./log')
|
||||||
@@ -16,7 +14,7 @@ var log = require('./log')
|
|||||||
*/
|
*/
|
||||||
function init () {
|
function init () {
|
||||||
if (!app.dock) return
|
if (!app.dock) return
|
||||||
var menu = electron.Menu.buildFromTemplate(getMenuTemplate())
|
var menu = Menu.buildFromTemplate(getMenuTemplate())
|
||||||
app.dock.setMenu(menu)
|
app.dock.setMenu(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,9 +31,12 @@ function downloadFinished (path) {
|
|||||||
* Display a counter badge for the app. (Mac, Linux)
|
* Display a counter badge for the app. (Mac, Linux)
|
||||||
*/
|
*/
|
||||||
function setBadge (count) {
|
function setBadge (count) {
|
||||||
|
if (process.platform === 'darwin' ||
|
||||||
|
process.platform === 'linux' && app.isUnityRunning()) {
|
||||||
log(`setBadge: ${count}`)
|
log(`setBadge: ${count}`)
|
||||||
app.setBadgeCount(Number(count))
|
app.setBadgeCount(Number(count))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getMenuTemplate () {
|
function getMenuTemplate () {
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user