Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error on Windows caused by setBadge #867

Merged
merged 1 commit into from
Sep 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/main/dock.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module.exports = {
setBadge
}

var electron = require('electron')

var app = electron.app
var {app, Menu} = require('electron')

var dialog = require('./dialog')
var log = require('./log')
Expand All @@ -16,7 +14,7 @@ var log = require('./log')
*/
function init () {
if (!app.dock) return
var menu = electron.Menu.buildFromTemplate(getMenuTemplate())
var menu = Menu.buildFromTemplate(getMenuTemplate())
app.dock.setMenu(menu)
}

Expand All @@ -33,8 +31,11 @@ function downloadFinished (path) {
* Display a counter badge for the app. (Mac, Linux)
*/
function setBadge (count) {
log(`setBadge: ${count}`)
app.setBadgeCount(Number(count))
if (process.platform === 'darwin' ||
process.platform === 'linux' && app.isUnityRunning()) {
log(`setBadge: ${count}`)
app.setBadgeCount(Number(count))
}
}

function getMenuTemplate () {
Expand Down