1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-24 11:02:47 +03:00

fixed terminal not getting focus when switching windows (fixes #692)

This commit is contained in:
Eugene Pankov 2019-12-31 23:20:07 +01:00
parent b07a2113d2
commit 21cb452d62
3 changed files with 15 additions and 0 deletions

View File

@ -202,6 +202,10 @@ export class Window {
}
})
this.window.on('focus', () => {
this.send('host:window-focused')
})
ipcMain.on('window-focus', event => {
if (!this.window || event.sender !== this.window.webContents) {
return

View File

@ -83,6 +83,10 @@ export class AppService {
this.startTabStorage()
}
}
hostApp.windowFocused$.subscribe(() => {
this._activeTab?.emitFocused()
})
}
startTabStorage () {

View File

@ -39,6 +39,7 @@ export class HostAppService {
private configChangeBroadcast = new Subject<void>()
private windowCloseRequest = new Subject<void>()
private windowMoved = new Subject<void>()
private windowFocused = new Subject<void>()
private displayMetricsChanged = new Subject<void>()
private logger: Logger
private windowId: number
@ -85,6 +86,8 @@ export class HostAppService {
get windowMoved$ (): Observable<void> { return this.windowMoved }
get windowFocused$ (): Observable<void> { return this.windowFocused }
get displayMetricsChanged$ (): Observable<void> { return this.displayMetricsChanged }
private constructor (
@ -128,6 +131,10 @@ export class HostAppService {
this.zone.run(() => this.windowMoved.next())
})
electron.ipcRenderer.on('host:window-focused', () => {
this.zone.run(() => this.windowFocused.next())
})
electron.ipcRenderer.on('host:display-metrics-changed', () => {
this.zone.run(() => this.displayMetricsChanged.next())
})