diff --git a/electron-globals.js b/electron-globals.js new file mode 100644 index 0000000..9259511 --- /dev/null +++ b/electron-globals.js @@ -0,0 +1,9 @@ +var ipc = require('electron').ipcRenderer; + +var setElectronBadge = function(value) { + if (ipc && typeof ipc.send === 'function') { + ipc.send('badge', value); + } +}; + +global.setElectronBadge = setElectronBadge; diff --git a/electron-main.js b/electron-main.js index 4baf51a..43420a2 100644 --- a/electron-main.js +++ b/electron-main.js @@ -187,10 +187,12 @@ mainWindow = new BrowserWindow({width: 1280, height: 800, 'min-width': 1024, 'min-height': 600, 'autoHideMenuBar': true, 'web-security': true, 'java': false, 'icon':'file://'+__dirname + 'assets/img/favicon.png'}); mainWindow.loadUrl('file://' + __dirname + '/electron-start.html'); - /* + ipcMain.on('badge', function(event, arg) { - app.dock.setBadge(String(arg)); - });*/ + if (process.platform === "darwin") { + app.dock.setBadge(String(arg)); + } + }); mainWindow.on('devtools-opened', function() { mainWindow.webContents.executeJavaScript("document.getElementById('glowingbear').openDevTools();"); }); diff --git a/electron-start.html b/electron-start.html index 6e7e28a..c6f0710 100644 --- a/electron-start.html +++ b/electron-start.html @@ -26,6 +26,6 @@ onload = function() {
-