Closed rubencodes closed 8 years ago
Seeing same thing on Windows... Will post code snippet in a minute.
So this is my main rendering file, where I use electon-notification-shim
. Is this correct usage?
import { app, BrowserWindow, Menu } from 'electron';
import ipc from 'ipc';
import windowStateKeeper from './vendor/electron_boilerplate/window_state';
var mainWindow;
// Preserver of the window size and position between app launches.
var mainWindowState = windowStateKeeper('main', {
width: 1000,
height: 600
});
app.on('ready', function () {
mainWindow = new BrowserWindow({
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
height: mainWindowState.height,
frame: false
});
if (mainWindowState.isMaximized) {
mainWindow.maximize();
}
// if(process.platform === 'win32') {
require('electron-notification-shim')();
// }
// Listen for notification events.
ipc.on('notification-shim', (e, msg) => {
console.log(msg);
});
mainWindow.on('close', function () {
mainWindowState.saveState(mainWindow);
});
});
app.on('window-all-closed', function () {
app.quit();
});
EDIT: Found that if I move
// if(process.platform === 'win32') {
require('electron-notification-shim')();
// }
into the browser JS file, it looks like it works!
@rubencodes Glad you got it working! Is there some way I could make this clearer in the readme? Maybe if I put the file names as headers in the readme, instead of comments inside the code blocks of the readme?
Tbqh I didn't know what "main process" and "renderer process" meant in regards to electron, so it was a terminology gap on my part. In retrospect it's quite obvious haha...
Getting this issue on Mac, using electron-prebuilt@0.37.4. Note: native notifications work great, I'm using this package specifically for Windows, but this probably shouldn't be happening?
`