Skip to content

Commit

Permalink
avoid unnecessary touchbar updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jun 18, 2022
1 parent 78cd2a0 commit 1a1381a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tabby-electron/src/services/touchbar.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import deepEqual from 'deep-equal'
import { Subject, distinctUntilChanged } from 'rxjs'
import { Subject, distinctUntilChanged, map } from 'rxjs'
import { ipcRenderer } from 'electron'
import { Injectable, NgZone } from '@angular/core'
import { AppService, HostAppService, Platform } from 'tabby-core'
Expand All @@ -22,7 +22,10 @@ export class TouchbarService {

app.tabOpened$.subscribe(tab => {
tab.titleChange$.subscribe(() => this.update())
tab.activity$.subscribe(() => this.update())
tab.activity$.pipe(
map(x => !x || tab === app.activeTab),
distinctUntilChanged(),
).subscribe(() => this.update())
})

ipcRenderer.on('touchbar-selection', (_event, index) => this.zone.run(() => {
Expand Down

0 comments on commit 1a1381a

Please sign in to comment.