|
|
@ -1,8 +1,7 @@ |
|
|
|
'use strict' |
|
|
|
'use strict' |
|
|
|
/* global __static */ |
|
|
|
/* global __static */ |
|
|
|
import path from 'path' |
|
|
|
import path from 'path' |
|
|
|
import { app, protocol, BrowserWindow, Menu, Tray, ipcMain, dialog, nativeImage, nativeTheme, globalShortcut } from 'electron' |
|
|
|
import { app, protocol, BrowserWindow, Menu, Tray, ipcMain, dialog, powerMonitor, nativeImage, nativeTheme, globalShortcut } from 'electron' |
|
|
|
import { powerMonitor } from './background/powerMonitor' |
|
|
|
|
|
|
|
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' |
|
|
|
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' |
|
|
|
import backend from './bridge/backend' |
|
|
|
import backend from './bridge/backend' |
|
|
|
import DevSidecar from '@docmirror/dev-sidecar' |
|
|
|
import DevSidecar from '@docmirror/dev-sidecar' |
|
|
@ -15,6 +14,9 @@ const isMac = process.platform === 'darwin' |
|
|
|
// import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
|
|
|
// import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production' |
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 避免其他系统出现异常,只有 Windows 使用 './background/powerMonitor'
|
|
|
|
|
|
|
|
const _powerMonitor = isWindows ? require('./background/powerMonitor').powerMonitor : powerMonitor |
|
|
|
|
|
|
|
|
|
|
|
// Keep a global reference of the window object, if you don't, the window will
|
|
|
|
// Keep a global reference of the window object, if you don't, the window will
|
|
|
|
// be closed automatically when the JavaScript object is garbage collected.
|
|
|
|
// be closed automatically when the JavaScript object is garbage collected.
|
|
|
|
let win |
|
|
|
let win |
|
|
@ -192,7 +194,7 @@ function createWindow (startHideWindow) { |
|
|
|
|
|
|
|
|
|
|
|
// !!IMPORTANT
|
|
|
|
// !!IMPORTANT
|
|
|
|
if (isWindows) { |
|
|
|
if (isWindows) { |
|
|
|
powerMonitor.setupMainWindow(win) |
|
|
|
_powerMonitor.setupMainWindow(win) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (process.env.WEBPACK_DEV_SERVER_URL) { |
|
|
|
if (process.env.WEBPACK_DEV_SERVER_URL) { |
|
|
@ -450,7 +452,7 @@ if (!isFirstInstance) { |
|
|
|
log.info('error:', err) |
|
|
|
log.info('error:', err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
powerMonitor.on('shutdown', async (e) => { |
|
|
|
_powerMonitor.on('shutdown', async (e) => { |
|
|
|
if (e) { |
|
|
|
if (e) { |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
} |
|
|
|
} |
|
|
|