diff --git a/app/lib/window.ts b/app/lib/window.ts index c418245a..bdb7d150 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -182,6 +182,10 @@ export class Window { ipcMain.on('window-set-vibrancy', (_event, enabled) => { this.setVibrancy(enabled) }) + + ipcMain.on('window-set-title', (_event, title) => { + this.window.setTitle(title) + }) } private destroy () { diff --git a/terminus-core/src/components/tabHeader.component.scss b/terminus-core/src/components/tabHeader.component.scss index 4e88a995..27c6aff4 100644 --- a/terminus-core/src/components/tabHeader.component.scss +++ b/terminus-core/src/components/tabHeader.component.scss @@ -13,8 +13,6 @@ $tabs-height: 36px; overflow: hidden; - transition: 0.125s ease-out all; - .index { flex: none; font-weight: bold; diff --git a/terminus-core/src/services/app.service.ts b/terminus-core/src/services/app.service.ts index ef2b69e0..d275b85b 100644 --- a/terminus-core/src/services/app.service.ts +++ b/terminus-core/src/services/app.service.ts @@ -50,7 +50,7 @@ export class AppService { tab.titleChange$.subscribe(title => { if (tab === this.activeTab) { - this.hostApp.getWindow().setTitle(title) + this.hostApp.setTitle(title) } }) return tab @@ -75,7 +75,7 @@ export class AppService { if (this.activeTab) { this.activeTab.emitFocused() } - this.hostApp.getWindow().setTitle(this.activeTab.title) + this.hostApp.setTitle(this.activeTab.title) } toggleLastTab () { diff --git a/terminus-core/src/services/hostApp.service.ts b/terminus-core/src/services/hostApp.service.ts index e18e858e..e3c77845 100644 --- a/terminus-core/src/services/hostApp.service.ts +++ b/terminus-core/src/services/hostApp.service.ts @@ -151,6 +151,10 @@ export class HostAppService { } } + setTitle (title: string) { + this.electron.ipcRenderer.send('window-set-title', title) + } + broadcastConfigChange () { this.electron.ipcRenderer.send('app:config-change') } diff --git a/terminus-core/src/services/touchbar.service.ts b/terminus-core/src/services/touchbar.service.ts index ea1b0b09..ad16b5b6 100644 --- a/terminus-core/src/services/touchbar.service.ts +++ b/terminus-core/src/services/touchbar.service.ts @@ -10,6 +10,7 @@ import { IToolbarButton, ToolbarButtonProvider } from '../api' export class TouchbarService { private tabsSegmentedControl: TouchBarSegmentedControl private tabSegments: SegmentedControlSegment[] = [] + private nsImageCache: {[id: string]: Electron.NativeImage} = {} constructor ( private app: AppService, @@ -59,12 +60,18 @@ export class TouchbarService { private getButton (button: IToolbarButton): Electron.TouchBarButton { return new this.electron.TouchBar.TouchBarButton({ label: button.touchBarNSImage ? null : this.shortenTitle(button.touchBarTitle || button.title), - icon: button.touchBarNSImage ? - this.electron.nativeImage.createFromNamedImage(button.touchBarNSImage, [0, 0, 1]) : null, + icon: button.touchBarNSImage ? this.getCachedNSImage(button.touchBarNSImage) : null, click: () => this.zone.run(() => button.click()), }) } + private getCachedNSImage (name: string) { + if (!this.nsImageCache[name]) { + this.nsImageCache[name] = this.electron.nativeImage.createFromNamedImage(name, [0, 0, 1]) + } + return this.nsImageCache[name] + } + private shortenTitle (title: string): string { if (title.length > 15) { title = title.substring(0, 15) + '...'