separate color schemes per profile - fixes #5885, fixes #4593, fixes #3516, fixes #7457, fixes #765

This commit is contained in:
Eugene Pankov
2023-02-04 19:51:16 +01:00
parent e0181973f7
commit 69d884e164
32 changed files with 192 additions and 106 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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
}
}

View File

@@ -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,
},
})