don't open second window on app restart when in dock mode (fixes #2449)

上级 5aa3b889
...@@ -137,6 +137,13 @@ export class Application { ...@@ -137,6 +137,13 @@ export class Application {
} }
} }
handleSecondInstance (argv: string[], cwd: string): void {
this.presentAllWindows()
for (let window of this.windows) {
window.handleSecondInstance(argv, cwd)
}
}
private setupMenu () { private setupMenu () {
let template: Electron.MenuItemConstructorOptions[] = [ let template: Electron.MenuItemConstructorOptions[] = [
{ {
......
...@@ -34,8 +34,7 @@ process.on('uncaughtException' as any, err => { ...@@ -34,8 +34,7 @@ process.on('uncaughtException' as any, err => {
}) })
app.on('second-instance', (_event, argv, cwd) => { app.on('second-instance', (_event, argv, cwd) => {
application.presentAllWindows() application.handleSecondInstance(argv, cwd)
application.send('host:second-instance', parseArgs(argv, cwd), cwd)
}) })
const argv = parseArgs(process.argv, process.cwd()) const argv = parseArgs(process.argv, process.cwd())
......
...@@ -5,6 +5,7 @@ import ElectronConfig = require('electron-config') ...@@ -5,6 +5,7 @@ import ElectronConfig = require('electron-config')
import * as os from 'os' import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import { parseArgs } from './cli'
import { loadConfig } from './config' import { loadConfig } from './config'
let SetWindowCompositionAttribute: any let SetWindowCompositionAttribute: any
...@@ -210,6 +211,12 @@ export class Window { ...@@ -210,6 +211,12 @@ export class Window {
} }
} }
handleSecondInstance (argv: string[], cwd: string): void {
if (!this.configStore.appearance?.dock) {
this.send('host:second-instance', parseArgs(argv, cwd), cwd)
}
}
private setupWindowManagement () { private setupWindowManagement () {
this.window.on('show', () => { this.window.on('show', () => {
this.visible.next(true) this.visible.next(true)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册