imporve formatting main.js
This commit is contained in:
parent
8e47bb13c6
commit
8ba26af235
30
src/main.ts
30
src/main.ts
|
@ -21,7 +21,7 @@ function createWindow() {
|
||||||
const appImgPath = isDev
|
const appImgPath = isDev
|
||||||
? 'build/window-icon.png'
|
? 'build/window-icon.png'
|
||||||
: path.join(process.resourcesPath, 'window-icon.png');
|
: path.join(process.resourcesPath, 'window-icon.png');
|
||||||
let appIcon = nativeImage.createFromPath(appImgPath);
|
const appIcon = nativeImage.createFromPath(appImgPath);
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
const mainWindow = new BrowserWindow({
|
const mainWindow = new BrowserWindow({
|
||||||
height: 600,
|
height: 600,
|
||||||
|
@ -59,8 +59,8 @@ function createWindow() {
|
||||||
isDev
|
isDev
|
||||||
? mainWindow.loadFile(`../build/error.html`)
|
? mainWindow.loadFile(`../build/error.html`)
|
||||||
: splash.loadURL(
|
: splash.loadURL(
|
||||||
`file://${path.join(process.resourcesPath, 'error.html')}`
|
`file://${path.join(process.resourcesPath, 'error.html')}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
@ -93,14 +93,14 @@ app.on('ready', () => {
|
||||||
const trayImgPath = isDev
|
const trayImgPath = isDev
|
||||||
? 'build/taskbar-icon.png'
|
? 'build/taskbar-icon.png'
|
||||||
: path.join(process.resourcesPath, 'taskbar-icon.png');
|
: path.join(process.resourcesPath, 'taskbar-icon.png');
|
||||||
let trayIcon = nativeImage.createFromPath(trayImgPath);
|
const trayIcon = nativeImage.createFromPath(trayImgPath);
|
||||||
tray = new Tray(trayIcon);
|
tray = new Tray(trayIcon);
|
||||||
tray.setToolTip('ente');
|
tray.setToolTip('ente');
|
||||||
tray.setContextMenu(buildContextMenu());
|
tray.setContextMenu(buildContextMenu());
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('select-dir', async (event) => {
|
ipcMain.on('select-dir', async (event) => {
|
||||||
let dialogWindow = new BrowserWindow({
|
const dialogWindow = new BrowserWindow({
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600,
|
height: 600,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
@ -131,7 +131,7 @@ ipcMain.on('send-notification', (event, args) => {
|
||||||
new Notification(notification).show();
|
new Notification(notification).show();
|
||||||
});
|
});
|
||||||
ipcMain.on('reload-window', (event, args) => {
|
ipcMain.on('reload-window', (event, args) => {
|
||||||
let secondWindow = createWindow();
|
const secondWindow = createWindow();
|
||||||
mainWindow.destroy();
|
mainWindow.destroy();
|
||||||
mainWindow = secondWindow;
|
mainWindow = secondWindow;
|
||||||
});
|
});
|
||||||
|
@ -140,15 +140,15 @@ function buildContextMenu(export_progress: any = null) {
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
...(export_progress
|
...(export_progress
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: export_progress,
|
label: export_progress,
|
||||||
click: () => mainWindow.show(),
|
click: () => mainWindow.show(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'stop export',
|
label: 'stop export',
|
||||||
click: () => mainWindow.webContents.send('stop-export'),
|
click: () => mainWindow.webContents.send('stop-export'),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue