mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Profile } from 'tabby-core'
|
||||
import { BaseTerminalProfile } from 'tabby-terminal'
|
||||
|
||||
export interface Shell {
|
||||
id: string
|
||||
@@ -44,7 +44,7 @@ export interface SessionOptions {
|
||||
runAsAdministrator?: boolean
|
||||
}
|
||||
|
||||
export interface LocalProfile extends Profile {
|
||||
export interface LocalProfile extends BaseTerminalProfile {
|
||||
options: SessionOptions
|
||||
}
|
||||
|
||||
|
@@ -13,9 +13,8 @@ import { UACService } from '../services/uac.service'
|
||||
styles: BaseTerminalTabComponent.styles,
|
||||
animations: BaseTerminalTabComponent.animations,
|
||||
})
|
||||
export class TerminalTabComponent extends BaseTerminalTabComponent {
|
||||
export class TerminalTabComponent extends BaseTerminalTabComponent<LocalProfile> {
|
||||
@Input() sessionOptions: SessionOptions // Deprecated
|
||||
@Input() profile: LocalProfile
|
||||
session: Session|null = null
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
|
@@ -30,7 +30,7 @@ export class TerminalService {
|
||||
* Launches a new terminal with a specific shell and CWD
|
||||
* @param pause Wait for a keypress when the shell exits
|
||||
*/
|
||||
async openTab (profile?: PartialProfile<LocalProfile>|null, cwd?: string|null, pause?: boolean): Promise<TerminalTabComponent> {
|
||||
async openTab (profile?: PartialProfile<LocalProfile>|null, cwd?: string|null, pause?: boolean): Promise<TerminalTabComponent|null> {
|
||||
if (!profile) {
|
||||
profile = await this.getDefaultProfile()
|
||||
}
|
||||
@@ -55,6 +55,6 @@ export class TerminalService {
|
||||
return (await this.profilesService.openNewTabForProfile({
|
||||
...fullProfile,
|
||||
options,
|
||||
})) as TerminalTabComponent
|
||||
})) as TerminalTabComponent|null
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
||||
if (!(tab instanceof TerminalTabComponent)) {
|
||||
return []
|
||||
}
|
||||
const terminalTab = tab
|
||||
const items: MenuItemOptions[] = [
|
||||
{
|
||||
label: this.translate.instant('Save as profile'),
|
||||
@@ -34,8 +35,8 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
|
||||
}
|
||||
const profile = {
|
||||
options: {
|
||||
...tab.profile.options,
|
||||
cwd: await tab.session?.getWorkingDirectory() ?? tab.profile.options.cwd,
|
||||
...terminalTab.profile.options,
|
||||
cwd: await terminalTab.session?.getWorkingDirectory() ?? terminalTab.profile.options.cwd,
|
||||
},
|
||||
name,
|
||||
type: 'local',
|
||||
@@ -117,13 +118,14 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
|
||||
}
|
||||
|
||||
if (tab instanceof TerminalTabComponent && tabHeader && this.uac.isAvailable) {
|
||||
const terminalTab = tab
|
||||
items.push({
|
||||
label: this.translate.instant('Duplicate as administrator'),
|
||||
click: () => {
|
||||
this.profilesService.openNewTabForProfile({
|
||||
...tab.profile,
|
||||
...terminalTab.profile,
|
||||
options: {
|
||||
...tab.profile.options,
|
||||
...terminalTab.profile.options,
|
||||
runAsAdministrator: true,
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user