refactor: 修复无法开机启动的问题
							parent
							
								
									bcc3080912
								
							
						
					
					
						commit
						43002533ee
					
				| 
						 | 
				
			
			@ -34,7 +34,7 @@ function setTray (app) {
 | 
			
		|||
      // 系统托盘图标目录
 | 
			
		||||
      label: '退出',
 | 
			
		||||
      click: () => {
 | 
			
		||||
        console.log('force quit')
 | 
			
		||||
        log.info('force quit')
 | 
			
		||||
        forceClose = true
 | 
			
		||||
        quit(app)
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +100,9 @@ function createWindow () {
 | 
			
		|||
    if (args.hideWindow) {
 | 
			
		||||
      startHideWindow = true
 | 
			
		||||
    }
 | 
			
		||||
    log.info('start args', args)
 | 
			
		||||
  }
 | 
			
		||||
  log.info('start hide window', startHideWindow)
 | 
			
		||||
 | 
			
		||||
  win = new BrowserWindow({
 | 
			
		||||
    width: 900,
 | 
			
		||||
| 
						 | 
				
			
			@ -194,7 +196,7 @@ if (!isFirstInstance) {
 | 
			
		|||
 | 
			
		||||
  // Quit when all windows are closed.
 | 
			
		||||
  app.on('window-all-closed', () => {
 | 
			
		||||
    console.log('window-all-closed')
 | 
			
		||||
    log.info('window-all-closed')
 | 
			
		||||
    // On macOS it is common for applications and their menu bar
 | 
			
		||||
    // to stay active until the user quits explicitly with Cmd + Q
 | 
			
		||||
    if (process.platform !== 'darwin') {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ export default {
 | 
			
		|||
  install (context) {
 | 
			
		||||
    const { ipcMain, dialog, log, app } = context
 | 
			
		||||
 | 
			
		||||
    const ex = process.execPath
 | 
			
		||||
    const ex = app.getPath('exe')
 | 
			
		||||
 | 
			
		||||
    // 定义事件,渲染进程中直接使用
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ export default {
 | 
			
		|||
            openAtLogin: true,
 | 
			
		||||
            path: ex,
 | 
			
		||||
            args: [
 | 
			
		||||
              '--process-start-args', '"--hidden"'
 | 
			
		||||
              '--hideWindow', '"true"'
 | 
			
		||||
            ]
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,8 +67,8 @@ module.exports = {
 | 
			
		|||
          ]
 | 
			
		||||
        },
 | 
			
		||||
        win: {
 | 
			
		||||
          icon: 'build/icons/',
 | 
			
		||||
          requestedExecutionLevel: 'requireAdministrator'
 | 
			
		||||
          icon: 'build/icons/'
 | 
			
		||||
          // requestedExecutionLevel: 'highestAvailable' // 加了这个无法开机自启
 | 
			
		||||
        },
 | 
			
		||||
        linux: {
 | 
			
		||||
          icon: 'build/mac/',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue