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,5 +1,4 @@
import { Profile } from 'tabby-core'
import { LoginScriptsOptions } from 'tabby-terminal'
import { BaseTerminalProfile, LoginScriptsOptions } from 'tabby-terminal'
export enum SSHAlgorithmType {
HMAC = 'hmac',
@@ -8,7 +7,7 @@ export enum SSHAlgorithmType {
HOSTKEY = 'serverHostKey',
}
export interface SSHProfile extends Profile {
export interface SSHProfile extends BaseTerminalProfile {
options: SSHProfileOptions
}

View File

@@ -248,6 +248,11 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
div(*ngFor='let alg of supportedAlgorithms.serverHostKey')
checkbox([text]='alg', [(ngModel)]='algorithms.serverHostKey[alg]')
li(ngbNavItem)
a(ngbNavLink, translate) Color scheme
ng-template(ngbNavContent)
color-scheme-selector([(model)]='profile.terminalColorScheme')
li(ngbNavItem)
a(ngbNavLink, translate) Login scripts
ng-template(ngbNavContent)

View File

@@ -19,9 +19,8 @@ import { SSHMultiplexerService } from '../services/sshMultiplexer.service'
styles: [require('./sshTab.component.scss'), ...BaseTerminalTabComponent.styles],
animations: BaseTerminalTabComponent.animations,
})
export class SSHTabComponent extends BaseTerminalTabComponent {
export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> {
Platform = Platform
profile?: SSHProfile
sshSession: SSHSession|null = null
session: SSHShellSession|null = null
sftpPanelVisible = false
@@ -45,10 +44,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
}
ngOnInit (): void {
if (!this.profile) {
throw new Error('Profile not set')
}
this.logger = this.log.create('terminalTab')
this.subscribeUntilDestroyed(this.hotkeys.hotkey$, hotkey => {
@@ -184,10 +179,6 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
}
private async initializeSessionMaybeMultiplex (multiplex = true): Promise<void> {
if (!this.profile) {
throw new Error('No SSH connection info supplied')
}
this.sshSession = await this.setupOneSession(this.injector, this.profile, multiplex)
const session = new SSHShellSession(this.injector, this.sshSession, this.profile)
@@ -244,13 +235,13 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
if (!this.session?.open) {
return true
}
if (!(this.profile?.options.warnOnClose ?? this.config.store.ssh.warnOnClose)) {
if (!(this.profile.options.warnOnClose ?? this.config.store.ssh.warnOnClose)) {
return true
}
return (await this.platform.showMessageBox(
{
type: 'warning',
message: this.translate.instant(_('Disconnect from {host}?'), this.profile?.options),
message: this.translate.instant(_('Disconnect from {host}?'), this.profile.options),
buttons: [
this.translate.instant(_('Disconnect')),
this.translate.instant(_('Do not close')),

View File

@@ -18,7 +18,7 @@ export class SFTPContextMenu extends TabContextMenuItemProvider {
}
async getItems (tab: BaseTabComponent): Promise<MenuItemOptions[]> {
if (!(tab instanceof SSHTabComponent) || !tab.profile) {
if (!(tab instanceof SSHTabComponent)) {
return []
}
const items = [{