From 1a1381a64a76a1e3f4069e5c510aba531d68b699 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 18 Jun 2022 12:40:22 +0200 Subject: [PATCH] avoid unnecessary touchbar updates --- tabby-electron/src/services/touchbar.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tabby-electron/src/services/touchbar.service.ts b/tabby-electron/src/services/touchbar.service.ts index 369a33b993..e0f9b1703b 100644 --- a/tabby-electron/src/services/touchbar.service.ts +++ b/tabby-electron/src/services/touchbar.service.ts @@ -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' @@ -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(() => {