diff --git a/tabby-core/src/api/tabRecovery.ts b/tabby-core/src/api/tabRecovery.ts index 51257c68..49d8558d 100644 --- a/tabby-core/src/api/tabRecovery.ts +++ b/tabby-core/src/api/tabRecovery.ts @@ -4,6 +4,7 @@ import { NewTabParameters } from '../services/tabs.service' export interface RecoveryToken { [_: string]: any type: string + tabIcon?: string|null tabColor?: string|null } diff --git a/tabby-core/src/components/baseTab.component.ts b/tabby-core/src/components/baseTab.component.ts index 2abc07c8..59a463ad 100644 --- a/tabby-core/src/components/baseTab.component.ts +++ b/tabby-core/src/components/baseTab.component.ts @@ -51,6 +51,13 @@ export abstract class BaseTabComponent extends BaseComponent { set color (value: string|null) { this._color = value } private _color: string|null = null + /** + * icon override for the tab's header + */ + get icon (): string|null { return this._icon } + set icon (value: string|null) { this._icon = value } + private _icon: string|null = null + hasFocus = false /** diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index 1c4e43fa..9c1d1e09 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -624,6 +624,16 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit super.clearActivity() } + get icon (): string|null { + return this.getFocusedTab()?.icon ?? null + } + + set icon (icon: string|null) { + for (const t of this.getAllTabs()) { + t.icon = icon + } + } + get color (): string|null { return this.getFocusedTab()?.color ?? null } diff --git a/tabby-core/src/components/tabHeader.component.pug b/tabby-core/src/components/tabHeader.component.pug index 0b903463..11228190 100644 --- a/tabby-core/src/components/tabHeader.component.pug +++ b/tabby-core/src/components/tabHeader.component.pug @@ -5,6 +5,8 @@ .index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform === Platform.macOS', cdkDragHandle) {{index + 1}} .index(*ngIf='!config.store.terminal.hideTabIndex && hostApp.platform !== Platform.macOS') {{index + 1}} +.icon(class='fa-fw {{tab.icon}}', style='{{ (tab.color)?"color:"+tab.color:"" }}', *ngIf='config.store.terminal.showTabProfileIcon') + .name( [title]='tab.customTitle || tab.title', [class.no-hover]='config.store.terminal.hideCloseButton' diff --git a/tabby-core/src/components/tabHeader.component.scss b/tabby-core/src/components/tabHeader.component.scss index 81284646..5cf6144e 100644 --- a/tabby-core/src/components/tabHeader.component.scss +++ b/tabby-core/src/components/tabHeader.component.scss @@ -26,7 +26,8 @@ $tabs-height: 38px; height: $tabs-height; } - .index { + .index, + .icon { flex: none; font-weight: bold; -webkit-app-region: no-drag; diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index 607d8c09..7c287038 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -54,6 +54,9 @@ export class ProfilesService { if (fullProfile.color) { params.inputs['color'] = fullProfile.color } + if (fullProfile.icon) { + params.inputs['icon'] = fullProfile.icon + } } return params } diff --git a/tabby-core/src/services/tabRecovery.service.ts b/tabby-core/src/services/tabRecovery.service.ts index 9f64c0a1..ce6ccb96 100644 --- a/tabby-core/src/services/tabRecovery.service.ts +++ b/tabby-core/src/services/tabRecovery.service.ts @@ -35,6 +35,9 @@ export class TabRecoveryService { if (token) { token.tabTitle = tab.title token.tabCustomTitle = tab.customTitle + if (tab.icon) { + token.tabIcon = tab.icon + } if (tab.color) { token.tabColor = tab.color } @@ -51,6 +54,7 @@ export class TabRecoveryService { } const tab = await provider.recover(token) tab.inputs = tab.inputs ?? {} + tab.inputs.icon = token.tabIcon ?? null tab.inputs.color = token.tabColor ?? null tab.inputs.title = token.tabTitle || '' tab.inputs.customTitle = token.tabCustomTitle || '' diff --git a/tabby-settings/src/components/windowSettingsTab.component.pug b/tabby-settings/src/components/windowSettingsTab.component.pug index 9ceb9362..f4b519ff 100644 --- a/tabby-settings/src/components/windowSettingsTab.component.pug +++ b/tabby-settings/src/components/windowSettingsTab.component.pug @@ -286,6 +286,15 @@ h3.mt-4(translate) Tabs (ngModelChange)='config.save();', ) +.form-line + .header + .title(translate) Show profile icon on tab + + toggle( + [(ngModel)]='config.store.terminal.showTabProfileIcon', + (ngModelChange)='config.save();', + ) + .form-line .header .title(translate) Hide tab close button diff --git a/tabby-terminal/src/config.ts b/tabby-terminal/src/config.ts index cc50243d..2acef16a 100644 --- a/tabby-terminal/src/config.ts +++ b/tabby-terminal/src/config.ts @@ -19,6 +19,7 @@ export class TerminalConfigProvider extends ConfigProvider { cursor: 'block', cursorBlink: true, hideTabIndex: false, + showTabProfileIcon: false, hideCloseButton: false, rightClick: 'menu', pasteOnMiddleClick: true,