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