-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
21 lines (16 loc) · 642 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const path = require('path');
const electron = require('electron');
const TimerTray = require('./myapp/timer_tray');
const MainWindow = require('./myapp/main_window');
const { app, ipcMain } = electron;
let mainWindow;
let tray;
app.on('ready', () => {
mainWindow = new MainWindow(`file://${__dirname}/src/index.html`);
const iconName = process.platform === 'win32' ? 'windows-icon@2x.png' : 'iconTemplate.png';
const iconPath = path.join(__dirname, `./src/assets/${iconName}`);
tray = new TimerTray(iconPath, mainWindow);
});
ipcMain.on('update-timer', (event, timeLeft) => {
tray.setTitle(timeLeft);
});