Commit 769d7164 authored by 神楽坂玲奈's avatar 神楽坂玲奈

tray

parent 8b56b547
...@@ -163,6 +163,7 @@ function createWindow() { ...@@ -163,6 +163,7 @@ function createWindow() {
} }
function createTray() { function createTray() {
console.log('create tray begin');
let tray = new Tray(path.join(process.env['NODE_ENV'] == 'production' ? process.resourcesPath : app.getAppPath(), 'images', 'icon.ico')); let tray = new Tray(path.join(process.env['NODE_ENV'] == 'production' ? process.resourcesPath : app.getAppPath(), 'images', 'icon.ico'));
tray.on('click', (event) => { tray.on('click', (event) => {
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show(); mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
...@@ -176,20 +177,24 @@ function createTray() { ...@@ -176,20 +177,24 @@ function createTray() {
} }
]); ]);
tray.setToolTip('MyCard'); tray.setToolTip('MyCard');
tray.setContextMenu(contextMenu) tray.setContextMenu(contextMenu);
console.log('create tray finish');
} }
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.on('ready', () => { app.on('ready', () => {
console.log('create window');
createWindow(); createWindow();
if (process.env['NODE_ENV'] == 'production') {
autoUpdater.checkForUpdates()
}
if (process.platform == 'win32') { if (process.platform == 'win32') {
console.log('before create tray');
createTray() createTray()
} }
if (process.env['NODE_ENV'] == 'production') {
autoUpdater.checkForUpdates()
}
console.log('update');
}); });
// Quit when all windows are closed. // Quit when all windows are closed.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment