mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-16 01:19:58 +00:00
fixed #610
This commit is contained in:
parent
38cfb3f036
commit
78f8f4005e
@ -5,19 +5,19 @@ import { Theme } from './api'
|
|||||||
export class StandardTheme extends Theme {
|
export class StandardTheme extends Theme {
|
||||||
name = 'Standard'
|
name = 'Standard'
|
||||||
css = require('./theme.scss')
|
css = require('./theme.scss')
|
||||||
terminalBackground = '#1D272D'
|
terminalBackground = '#222a33'
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StandardCompactTheme extends Theme {
|
export class StandardCompactTheme extends Theme {
|
||||||
name = 'Compact'
|
name = 'Compact'
|
||||||
css = require('./theme.compact.scss')
|
css = require('./theme.compact.scss')
|
||||||
terminalBackground = '#1D272D'
|
terminalBackground = '#222a33'
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PaperTheme extends Theme {
|
export class PaperTheme extends Theme {
|
||||||
name = 'Paper'
|
name = 'Paper'
|
||||||
css = require('./theme.paper.scss')
|
css = require('./theme.paper.scss')
|
||||||
terminalBackground = '#1D272D'
|
terminalBackground = '#f7f1e0'
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
this.session.releaseInitialDataBuffer()
|
this.session.releaseInitialDataBuffer()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.frontend.configure(this.config.store)
|
this.frontend.configure()
|
||||||
this.frontend.attach(this.content.nativeElement)
|
this.frontend.attach(this.content.nativeElement)
|
||||||
this.attachTermContainerHandlers()
|
this.attachTermContainerHandlers()
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure (): void {
|
configure (): void {
|
||||||
this.frontend.configure(this.config.store)
|
this.frontend.configure()
|
||||||
|
|
||||||
if (this.config.store.terminal.background === 'colorScheme') {
|
if (this.config.store.terminal.background === 'colorScheme') {
|
||||||
if (this.config.store.terminal.colorScheme.background) {
|
if (this.config.store.terminal.colorScheme.background) {
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
import { Observable, Subject, AsyncSubject, ReplaySubject, BehaviorSubject } from 'rxjs'
|
import { Observable, Subject, AsyncSubject, ReplaySubject, BehaviorSubject } from 'rxjs'
|
||||||
import { ResizeEvent } from '../api'
|
import { ResizeEvent } from '../api'
|
||||||
|
import { ConfigService, ThemesService } from 'terminus-core'
|
||||||
|
|
||||||
export abstract class Frontend {
|
export abstract class Frontend {
|
||||||
|
configService: ConfigService
|
||||||
|
themesService: ThemesService
|
||||||
|
|
||||||
enableResizing = true
|
enableResizing = true
|
||||||
protected ready = new AsyncSubject<void>()
|
protected ready = new AsyncSubject<void>()
|
||||||
protected title = new ReplaySubject<string>(1)
|
protected title = new ReplaySubject<string>(1)
|
||||||
@ -54,6 +58,6 @@ export abstract class Frontend {
|
|||||||
abstract visualBell (): void
|
abstract visualBell (): void
|
||||||
abstract scrollToBottom (): void
|
abstract scrollToBottom (): void
|
||||||
|
|
||||||
abstract configure (configStore: any): void
|
abstract configure (): void
|
||||||
abstract setZoom (zoom: number): void
|
abstract setZoom (zoom: number): void
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,9 @@ export class HTermFrontend extends Frontend {
|
|||||||
this.term.onVTKeystroke('\f')
|
this.term.onVTKeystroke('\f')
|
||||||
}
|
}
|
||||||
|
|
||||||
configure (config: any): void {
|
configure (): void {
|
||||||
|
let config = this.configService.store
|
||||||
|
|
||||||
this.configuredFontSize = config.terminal.fontSize
|
this.configuredFontSize = config.terminal.fontSize
|
||||||
this.configuredLinePadding = config.terminal.linePadding
|
this.configuredLinePadding = config.terminal.linePadding
|
||||||
this.setFontSize()
|
this.setFontSize()
|
||||||
@ -85,8 +87,7 @@ export class HTermFrontend extends Frontend {
|
|||||||
preferenceManager.set('background-color', config.terminal.colorScheme.background)
|
preferenceManager.set('background-color', config.terminal.colorScheme.background)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// hterm can't parse "transparent"
|
preferenceManager.set('background-color', config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground)
|
||||||
preferenceManager.set('background-color', 'transparent')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.configuredBackgroundColor = preferenceManager.get('background-color')
|
this.configuredBackgroundColor = preferenceManager.get('background-color')
|
||||||
|
@ -110,7 +110,9 @@ export class XTermFrontend extends Frontend {
|
|||||||
this.xtermCore._scrollToBottom()
|
this.xtermCore._scrollToBottom()
|
||||||
}
|
}
|
||||||
|
|
||||||
configure (config: any): void {
|
configure (): void {
|
||||||
|
let config = this.configService.store
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.xterm.cols && this.xterm.rows) {
|
if (this.xterm.cols && this.xterm.rows) {
|
||||||
this.resizeHandler()
|
this.resizeHandler()
|
||||||
@ -131,7 +133,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
|
|
||||||
let theme: ITheme = {
|
let theme: ITheme = {
|
||||||
foreground: config.terminal.colorScheme.foreground,
|
foreground: config.terminal.colorScheme.foreground,
|
||||||
background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : 'transparent',
|
background: (config.terminal.background === 'colorScheme') ? config.terminal.colorScheme.background : (config.appearance.vibrancy ? 'transparent' : this.themesService.findCurrentTheme().terminalBackground),
|
||||||
cursor: config.terminal.colorScheme.cursor,
|
cursor: config.terminal.colorScheme.cursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { ConfigService } from 'terminus-core'
|
import { ConfigService, ThemesService } from 'terminus-core'
|
||||||
import { Frontend } from '../frontends/frontend'
|
import { Frontend } from '../frontends/frontend'
|
||||||
import { HTermFrontend } from '../frontends/htermFrontend'
|
import { HTermFrontend } from '../frontends/htermFrontend'
|
||||||
import { XTermFrontend } from '../frontends/xtermFrontend'
|
import { XTermFrontend } from '../frontends/xtermFrontend'
|
||||||
@ -9,13 +9,16 @@ import { BaseSession } from '../services/sessions.service'
|
|||||||
export class TerminalFrontendService {
|
export class TerminalFrontendService {
|
||||||
private containers = new WeakMap<BaseSession, Frontend>()
|
private containers = new WeakMap<BaseSession, Frontend>()
|
||||||
|
|
||||||
constructor (private config: ConfigService) { }
|
constructor (private config: ConfigService, private themes: ThemesService) { }
|
||||||
|
|
||||||
getFrontend (session?: BaseSession): Frontend {
|
getFrontend (session?: BaseSession): Frontend {
|
||||||
if (!session) {
|
if (!session) {
|
||||||
return (this.config.store.terminal.frontend === 'xterm')
|
let frontend: Frontend = (this.config.store.terminal.frontend === 'xterm')
|
||||||
? new XTermFrontend()
|
? new XTermFrontend()
|
||||||
: new HTermFrontend()
|
: new HTermFrontend()
|
||||||
|
frontend.configService = this.config
|
||||||
|
frontend.themesService = this.themes
|
||||||
|
return frontend
|
||||||
}
|
}
|
||||||
if (!this.containers.has(session)) {
|
if (!this.containers.has(session)) {
|
||||||
this.containers.set(
|
this.containers.set(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user