mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-06 16:00:28 +08:00
potentially fixed #576
This commit is contained in:
parent
92afec75e7
commit
8793613117
@ -1,4 +1,5 @@
|
||||
import { Subject, Observable } from 'rxjs'
|
||||
import { debounceTime } from 'rxjs/operators'
|
||||
import { BrowserWindow, app, ipcMain, Rectangle } from 'electron'
|
||||
import ElectronConfig = require('electron-config')
|
||||
import * as os from 'os'
|
||||
@ -143,6 +144,16 @@ export class Window {
|
||||
this.visible.next(false)
|
||||
})
|
||||
|
||||
let moveSubscription = new Observable<void>(observer => {
|
||||
this.window.on('move', () => observer.next())
|
||||
}).pipe(debounceTime(250)).subscribe(() => {
|
||||
this.window.webContents.send('host:window-moved')
|
||||
})
|
||||
|
||||
this.window.on('closed', () => {
|
||||
moveSubscription.unsubscribe()
|
||||
})
|
||||
|
||||
this.window.on('enter-full-screen', () => this.window.webContents.send('host:window-enter-full-screen'))
|
||||
this.window.on('leave-full-screen', () => this.window.webContents.send('host:window-leave-full-screen'))
|
||||
|
||||
|
@ -30,6 +30,7 @@ export class HostAppService {
|
||||
private cliOpenProfile = new Subject<string>()
|
||||
private configChangeBroadcast = new Subject<void>()
|
||||
private windowCloseRequest = new Subject<void>()
|
||||
private windowMoved = new Subject<void>()
|
||||
private logger: Logger
|
||||
private windowId: number
|
||||
|
||||
@ -41,6 +42,7 @@ export class HostAppService {
|
||||
get cliOpenProfile$ (): Observable<string> { return this.cliOpenProfile }
|
||||
get configChangeBroadcast$ (): Observable<void> { return this.configChangeBroadcast }
|
||||
get windowCloseRequest$ (): Observable<void> { return this.windowCloseRequest }
|
||||
get windowMoved$ (): Observable<void> { return this.windowMoved }
|
||||
|
||||
constructor (
|
||||
private zone: NgZone,
|
||||
@ -80,6 +82,10 @@ export class HostAppService {
|
||||
this.zone.run(() => this.windowCloseRequest.next())
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on('host:window-moved', () => {
|
||||
this.zone.run(() => this.windowMoved.next())
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on('host:second-instance', (_$event, argv: any, cwd: string) => this.zone.run(() => {
|
||||
this.logger.info('Second instance', argv)
|
||||
const op = argv._[0]
|
||||
|
@ -276,7 +276,11 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
this.session.resize(columns, rows)
|
||||
}
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
||||
this.hostApp.windowMoved$.subscribe(() => setTimeout(() => {
|
||||
this.configure()
|
||||
}, 250)),
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user