1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- const { app, BrowserWindow, BrowserView, Tray, Menu, nativeImage } = require('electron')
- const por = require('child_process');
- const { error } = require('console');
- const { stdout, stderr } = require('process');
- let tray
- function createWindow () {
- const mainWindow = new BrowserWindow({
- width: 1000,
- height: 600,
- useContentSize: true,
- enableLargerThanScreen: true,
- autoHideMenuBar: true,
- icon: 'logo.png',
- webPreferences: {
-
-
-
- nodeIntegration: true,
-
-
-
- }
- });
- var view = new BrowserView()
- mainWindow.setBrowserView(view)
- view.setBounds({x:0,y:0, width: 1000,height: 600})
- view.setAutoResize({width: true, height: true})
- view.useContentSize = true
- view.webContents.loadURL('http://localhost:3004/html')
-
-
- }
- app.whenReady().then(() => {
- const icon = nativeImage.createFromPath('./logo.png')
- tray = new Tray(icon)
- const contextMenu = Menu.buildFromTemplate([])
-
- tray.setContextMenu(contextMenu)
- tray.setToolTip('This is my application')
- tray.setTitle('This is my title')
-
- createWindow()
-
- })
- app.on('window-all-closed', () => {
- if (process.platform !== 'darwin') {
- app.quit()
- }
- })
- app.on('activate', () => {
- if (BrowserWindow.getAllWindows().length === 0) {
- createWindow()
- }
- })
|