소스 검색

update

master
kim131 4 년 전
부모
커밋
b4b1138d18
1개의 변경된 파일19개의 추가작업 그리고 13개의 파일을 삭제
  1. +19
    -13
      src/main/index.js

+ 19
- 13
src/main/index.js 파일 보기

@@ -1,5 +1,5 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, protocol, ipcMain, dialog, nativeImage } = require('electron')
const { app, BrowserWindow, protocol, ipcMain, dialog, nativeImage, Menu, Tray } = require('electron')
const path = require('path')

const gotTheLock = app.requestSingleInstanceLock();
@@ -10,18 +10,22 @@ if (!gotTheLock) {
}

let mainWindow;
let tray = null;
function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1080,
height: 600,
minWidth: 400,
frame: false,
width: 1200,
height: 930,
minWidth: 1200,
minHeight: 930,
webPreferences: {
nodeIntegration: true,
// javascript: true,
// plugins: true,
preload: path.join(__dirname, './', 'preload.js'),
},
icon: path.join(__dirname, 'logo.ico'),
// frame: false,
})
// and load the index.html of the app.
@@ -34,8 +38,10 @@ function createWindow() {
mainWindow.setMenuBarVisibility(false);
// Open the DevTools.
// mainWindow.webContents.openDevTools()
mainWindow.maximize();
//mainWindow.maximize();

// 返回应用默认的session对象
// const ses = mainWindow.webContents.session;
// 当窗口已经关闭的时候触发
mainWindow.on('closed', (event) => {
mainWindow = null;
@@ -47,16 +53,16 @@ function createWindow() {
event.preventDefault();
});

mainWindow.on('show', () => {
tray.setHighlightMode('always')
})
mainWindow.on('hide', () => {
tray.setHighlightMode('never')
})
// mainWindow.on('show', () => {
// tray.setHighlightMode('always')
// })
// mainWindow.on('hide', () => {
// tray.setHighlightMode('never')
// })

// 创建系统通知区菜单
tray = new Tray(path.join(__dirname, 'file_word.png'));
const contextMenu = Menu.buildFromTemplate([
tray = new Tray(path.join(__dirname, 'logo.ico'));
const contextMenu = Menu.buildFromTemplate([
{label: '最大化', click: () => { mainWindow.maximize()}},
{label: '最小化', click: () => {mainWindow.minimize()}},
{label: '还原', click: () => {mainWindow.restore()}},


불러오는 중...
취소
저장