11import { Component , Input , Injector } from '@angular/core'
22import { BaseTabProcess , WIN_BUILD_CONPTY_SUPPORTED , isWindowsBuild } from 'tabby-core'
33import { BaseTerminalTabComponent } from 'tabby-terminal'
4- import { SessionOptions } from '../api'
4+ import { LocalProfile } from '../api'
55import { Session } from '../session'
66import { UACService } from '../services/uac.service'
7+ import { SessionOptions } from 'http2'
78
89/** @hidden */
910@Component ( {
@@ -13,7 +14,8 @@ import { UACService } from '../services/uac.service'
1314 animations : BaseTerminalTabComponent . animations ,
1415} )
1516export class TerminalTabComponent extends BaseTerminalTabComponent {
16- @Input ( ) sessionOptions : SessionOptions
17+ @Input ( ) sessionOptions : SessionOptions // Deprecated
18+ @Input ( ) profile : LocalProfile
1719 session : Session | null = null
1820
1921 // eslint-disable-next-line @typescript-eslint/no-useless-constructor
@@ -25,6 +27,8 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
2527 }
2628
2729 ngOnInit ( ) : void {
30+ this . sessionOptions = this . profile . options
31+
2832 this . logger = this . log . create ( 'terminalTab' )
2933 this . session = new Session ( this . injector )
3034
@@ -49,17 +53,17 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
4953
5054 protected onFrontendReady ( ) : void {
5155 this . initializeSession ( this . size . columns , this . size . rows )
52- this . savedStateIsLive = this . sessionOptions . restoreFromPTYID === this . session ?. getPTYID ( )
56+ this . savedStateIsLive = this . profile . options . restoreFromPTYID === this . session ?. getPTYID ( )
5357 super . onFrontendReady ( )
5458 }
5559
5660 initializeSession ( columns : number , rows : number ) : void {
57- if ( this . sessionOptions . runAsAdministrator && this . uac . isAvailable ) {
58- this . sessionOptions = this . uac . patchSessionOptionsForUAC ( this . sessionOptions )
61+ if ( this . profile . options . runAsAdministrator && this . uac . isAvailable ) {
62+ this . profile . options = this . uac . patchSessionOptionsForUAC ( this . profile . options )
5963 }
6064
6165 this . session ! . start ( {
62- ...this . sessionOptions ,
66+ ...this . profile . options ,
6367 width : columns ,
6468 height : rows ,
6569 } )
@@ -72,10 +76,13 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
7276 const cwd = this . session ? await this . session . getWorkingDirectory ( ) : null
7377 return {
7478 type : 'app:terminal-tab' ,
75- sessionOptions : {
76- ...this . sessionOptions ,
77- cwd : cwd ?? this . sessionOptions . cwd ,
78- restoreFromPTYID : this . session ?. getPTYID ( ) ,
79+ profile : {
80+ ...this . profile ,
81+ options : {
82+ ...this . profile . options ,
83+ cwd : cwd ?? this . profile . options . cwd ,
84+ restoreFromPTYID : this . session ?. getPTYID ( ) ,
85+ } ,
7986 } ,
8087 savedState : this . frontend ?. saveState ( ) ,
8188 }
0 commit comments