1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-09-20 09:27:16 +03:00

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

This commit is contained in:
Eugene Pankov 2020-05-02 17:23:35 +02:00
parent 5aa3b889f5
commit 0ad585d647
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
3 changed files with 15 additions and 2 deletions

View File

@ -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 () {
let template: Electron.MenuItemConstructorOptions[] = [
{

View File

@ -34,8 +34,7 @@ process.on('uncaughtException' as any, err => {
})
app.on('second-instance', (_event, argv, cwd) => {
application.presentAllWindows()
application.send('host:second-instance', parseArgs(argv, cwd), cwd)
application.handleSecondInstance(argv, cwd)
})
const argv = parseArgs(process.argv, process.cwd())

View File

@ -5,6 +5,7 @@ import ElectronConfig = require('electron-config')
import * as os from 'os'
import * as path from 'path'
import { parseArgs } from './cli'
import { loadConfig } from './config'
let SetWindowCompositionAttribute: any
@ -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 () {
this.window.on('show', () => {
this.visible.next(true)