|
|
@@ -1,17 +1,13 @@
|
|
|
-import { ipcRenderer, NativeImage } from 'electron'
|
|
|
+import { ipcRenderer } from 'electron'
|
|
|
import { Injectable, NgZone } from '@angular/core'
|
|
|
import { AppService, HostAppService, Platform } from 'tabby-core'
|
|
|
-import { ElectronService } from '../services/electron.service'
|
|
|
|
|
|
/** @hidden */
|
|
|
@Injectable({ providedIn: 'root' })
|
|
|
export class TouchbarService {
|
|
|
- private activityIcon: NativeImage
|
|
|
-
|
|
|
private constructor (
|
|
|
private app: AppService,
|
|
|
private hostApp: HostAppService,
|
|
|
- private electron: ElectronService,
|
|
|
private zone: NgZone,
|
|
|
) {
|
|
|
if (this.hostApp.platform !== Platform.macOS) {
|
|
|
@@ -20,9 +16,6 @@ export class TouchbarService {
|
|
|
app.tabsChanged$.subscribe(() => this.update())
|
|
|
app.activeTabChange$.subscribe(() => this.update())
|
|
|
|
|
|
- const activityIconPath = `${electron.app.getAppPath()}/assets/activity.png`
|
|
|
- this.activityIcon = this.electron.nativeImage.createFromPath(activityIconPath)
|
|
|
-
|
|
|
app.tabOpened$.subscribe(tab => {
|
|
|
tab.titleChange$.subscribe(() => this.update())
|
|
|
tab.activity$.subscribe(() => this.update())
|
|
|
@@ -40,7 +33,7 @@ export class TouchbarService {
|
|
|
|
|
|
const tabSegments = this.app.tabs.map(tab => ({
|
|
|
label: this.shortenTitle(tab.title),
|
|
|
- icon: this.app.activeTab !== tab && tab.hasActivity ? this.activityIcon : undefined,
|
|
|
+ hasActivity: this.app.activeTab !== tab && tab.hasActivity,
|
|
|
}))
|
|
|
|
|
|
ipcRenderer.send('window-set-touch-bar', tabSegments, this.app.activeTab ? this.app.tabs.indexOf(this.app.activeTab) : undefined)
|