优化 hidden 启动参数的行为
parent
49c8081f68
commit
1803517943
|
@ -84,16 +84,16 @@ export const initSingleInstanceHandle = () => {
|
|||
}
|
||||
|
||||
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 (global.envParams.deeplink) global.lx.event_app.deeplink(global.envParams.deeplink)
|
||||
else showMainWindow()
|
||||
const envParams = parseEnvParams(argv)
|
||||
if (envParams.deeplink) {
|
||||
global.envParams.deeplink = envParams.deeplink
|
||||
global.lx.event_app.deeplink(global.envParams.deeplink)
|
||||
return
|
||||
}
|
||||
if (envParams.cmdParams.hidden !== true) {
|
||||
showMainWindow()
|
||||
}
|
||||
} else {
|
||||
app.quit()
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ import { nativeTheme, powerSaveBlocker } from 'electron'
|
|||
import { joinPath } from '@common/utils/nodejs'
|
||||
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 = {}
|
||||
let deeplink = null
|
||||
const rx = /^-\w+/
|
||||
for (let param of process.argv) {
|
||||
for (let param of argv) {
|
||||
if (URL_SCHEME_RXP.test(param)) {
|
||||
deeplink = param
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue