优化 hidden 启动参数的行为
parent
49c8081f68
commit
1803517943
|
@ -84,16 +84,16 @@ export const initSingleInstanceHandle = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('second-instance', (event, argv, cwd) => {
|
app.on('second-instance', (event, argv, cwd) => {
|
||||||
for (const param of argv) {
|
|
||||||
if (URL_SCHEME_RXP.test(param)) {
|
|
||||||
global.envParams.deeplink = param
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isExistMainWindow()) {
|
if (isExistMainWindow()) {
|
||||||
if (global.envParams.deeplink) global.lx.event_app.deeplink(global.envParams.deeplink)
|
const envParams = parseEnvParams(argv)
|
||||||
else showMainWindow()
|
if (envParams.deeplink) {
|
||||||
|
global.envParams.deeplink = envParams.deeplink
|
||||||
|
global.lx.event_app.deeplink(global.envParams.deeplink)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (envParams.cmdParams.hidden !== true) {
|
||||||
|
showMainWindow()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
app.quit()
|
app.quit()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ import { nativeTheme, powerSaveBlocker } from 'electron'
|
||||||
import { joinPath } from '@common/utils/nodejs'
|
import { joinPath } from '@common/utils/nodejs'
|
||||||
import themes from '@common/theme/index.json'
|
import themes from '@common/theme/index.json'
|
||||||
|
|
||||||
export const parseEnvParams = (): { cmdParams: LX.CmdParams, deeplink: string | null } => {
|
export const parseEnvParams = (argv = process.argv): { cmdParams: LX.CmdParams, deeplink: string | null } => {
|
||||||
const cmdParams: LX.CmdParams = {}
|
const cmdParams: LX.CmdParams = {}
|
||||||
let deeplink = null
|
let deeplink = null
|
||||||
const rx = /^-\w+/
|
const rx = /^-\w+/
|
||||||
for (let param of process.argv) {
|
for (let param of argv) {
|
||||||
if (URL_SCHEME_RXP.test(param)) {
|
if (URL_SCHEME_RXP.test(param)) {
|
||||||
deeplink = param
|
deeplink = param
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue