mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-09 22:10:09 +00:00
profile and SSH connection colors (fixes #954)
This commit is contained in:
parent
a8d5cf469e
commit
2b5f623b50
@ -173,6 +173,17 @@ export class AppService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getParentTab (tab: BaseTabComponent): SplitTabComponent|null {
|
||||||
|
for (const topLevelTab of this.tabs) {
|
||||||
|
if (topLevelTab instanceof SplitTabComponent) {
|
||||||
|
if (topLevelTab.getAllTabs().includes(tab)) {
|
||||||
|
return topLevelTab
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
/** Switches between the current tab and the previously active one */
|
/** Switches between the current tab and the previously active one */
|
||||||
toggleLastTab () {
|
toggleLastTab () {
|
||||||
if (!this.lastTabIndex || this.lastTabIndex >= this.tabs.length) {
|
if (!this.lastTabIndex || this.lastTabIndex >= this.tabs.length) {
|
||||||
|
@ -30,6 +30,7 @@ export interface SSHConnection {
|
|||||||
keepaliveInterval?: number
|
keepaliveInterval?: number
|
||||||
keepaliveCountMax?: number
|
keepaliveCountMax?: number
|
||||||
readyTimeout?: number
|
readyTimeout?: number
|
||||||
|
color?: string
|
||||||
|
|
||||||
algorithms?: {[t: string]: string[]}
|
algorithms?: {[t: string]: string[]}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,17 @@
|
|||||||
button.btn.btn-secondary((click)='selectPrivateKey()')
|
button.btn.btn-secondary((click)='selectPrivateKey()')
|
||||||
i.fas.fa-folder-open
|
i.fas.fa-folder-open
|
||||||
|
|
||||||
|
.form-line
|
||||||
|
.header
|
||||||
|
.title Tab color
|
||||||
|
input.form-control(
|
||||||
|
type='text',
|
||||||
|
autofocus,
|
||||||
|
[(ngModel)]='connection.color',
|
||||||
|
placeholder='#000000'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
ngb-tab(id='advanced')
|
ngb-tab(id='advanced')
|
||||||
ng-template(ngbTabTitle) Advanced
|
ng-template(ngbTabTitle) Advanced
|
||||||
ng-template(ngbTabContent)
|
ng-template(ngbTabContent)
|
||||||
|
@ -32,10 +32,14 @@ export class SSHService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openTab (connection: SSHConnection): Promise<SSHTabComponent> {
|
async openTab (connection: SSHConnection): Promise<SSHTabComponent> {
|
||||||
return this.zone.run(() => this.app.openNewTab(
|
const tab = this.zone.run(() => this.app.openNewTab(
|
||||||
SSHTabComponent,
|
SSHTabComponent,
|
||||||
{ connection }
|
{ connection }
|
||||||
) as SSHTabComponent)
|
) as SSHTabComponent)
|
||||||
|
if (connection.color) {
|
||||||
|
(this.app.getParentTab(tab) || tab).color = connection.color
|
||||||
|
}
|
||||||
|
return tab
|
||||||
}
|
}
|
||||||
|
|
||||||
createSession (connection: SSHConnection): SSHSession {
|
createSession (connection: SSHConnection): SSHSession {
|
||||||
|
@ -16,8 +16,9 @@ export interface SessionOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Profile {
|
export interface Profile {
|
||||||
name: string,
|
name: string
|
||||||
sessionOptions: SessionOptions,
|
color?: string
|
||||||
|
sessionOptions: SessionOptions
|
||||||
isBuiltin?: boolean
|
isBuiltin?: boolean
|
||||||
icon?: string
|
icon?: string
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,15 @@
|
|||||||
[(model)]='profile.sessionOptions.env',
|
[(model)]='profile.sessionOptions.env',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.form-group
|
||||||
|
label Tab color
|
||||||
|
input.form-control(
|
||||||
|
type='text',
|
||||||
|
autofocus,
|
||||||
|
[(ngModel)]='profile.color',
|
||||||
|
placeholder='#000000'
|
||||||
|
)
|
||||||
|
|
||||||
.modal-footer
|
.modal-footer
|
||||||
button.btn.btn-outline-primary((click)='save()') Save
|
button.btn.btn-outline-primary((click)='save()') Save
|
||||||
button.btn.btn-outline-danger((click)='cancel()') Cancel
|
button.btn.btn-outline-danger((click)='cancel()') Cancel
|
||||||
|
@ -88,7 +88,11 @@ export class TerminalService {
|
|||||||
cwd: cwd || undefined,
|
cwd: cwd || undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.openTabWithOptions(sessionOptions)
|
const tab = this.openTabWithOptions(sessionOptions)
|
||||||
|
if (profile?.color) {
|
||||||
|
(this.app.getParentTab(tab) || tab).color = profile.color
|
||||||
|
}
|
||||||
|
return tab
|
||||||
}
|
}
|
||||||
|
|
||||||
optionsFromShell (shell: Shell): SessionOptions {
|
optionsFromShell (shell: Shell): SessionOptions {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user