mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-22 18:11:43 +03:00
.
This commit is contained in:
parent
3f25731bfd
commit
2cca57e0fb
3
app/src/api/defaultTabProvider.ts
Normal file
3
app/src/api/defaultTabProvider.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export abstract class DefaultTabProvider {
|
||||||
|
abstract open (): void
|
||||||
|
}
|
@ -3,6 +3,7 @@ export { TabRecoveryProvider } from './tabRecovery'
|
|||||||
export { ToolbarButtonProvider, IToolbarButton } from './toolbarButtonProvider'
|
export { ToolbarButtonProvider, IToolbarButton } from './toolbarButtonProvider'
|
||||||
export { ConfigProvider } from './configProvider'
|
export { ConfigProvider } from './configProvider'
|
||||||
export { HotkeyProvider, IHotkeyDescription } from './hotkeyProvider'
|
export { HotkeyProvider, IHotkeyDescription } from './hotkeyProvider'
|
||||||
|
export { DefaultTabProvider } from './defaultTabProvider'
|
||||||
|
|
||||||
export { AppService } from 'services/app'
|
export { AppService } from 'services/app'
|
||||||
export { ConfigService } from 'services/config'
|
export { ConfigService } from 'services/config'
|
||||||
|
@ -40,9 +40,6 @@ title-bar(*ngIf='!config.full().appearance.useNativeFrame && config.store.appear
|
|||||||
[class.scrollable]='tab.scrollable',
|
[class.scrollable]='tab.scrollable',
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO
|
|
||||||
//hotkey-hint
|
|
||||||
|
|
||||||
toaster-container([toasterconfig]="toasterconfig")
|
toaster-container([toasterconfig]="toasterconfig")
|
||||||
ng-template(ngbModalContainer)
|
ng-template(ngbModalContainer)
|
||||||
|
|
||||||
|
@ -101,8 +101,6 @@ export class AppRootComponent {
|
|||||||
this.hotkeys.globalHotkey.subscribe(() => {
|
this.hotkeys.globalHotkey.subscribe(() => {
|
||||||
this.onGlobalHotkey()
|
this.onGlobalHotkey()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.app.restoreTabs()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onGlobalHotkey () {
|
onGlobalHotkey () {
|
||||||
@ -132,19 +130,11 @@ export class AppRootComponent {
|
|||||||
|
|
||||||
getRightToolbarButtons (): IToolbarButton[] { return this.getToolbarButtons(true) }
|
getRightToolbarButtons (): IToolbarButton[] { return this.getToolbarButtons(true) }
|
||||||
|
|
||||||
ngOnInit () {
|
async ngOnInit () {
|
||||||
/*
|
await this.app.restoreTabs()
|
||||||
this.sessions.recoverAll().then((recoveredSessions) => {
|
if (this.app.tabs.length == 0) {
|
||||||
if (recoveredSessions.length > 0) {
|
this.app.openDefaultTab()
|
||||||
recoveredSessions.forEach((session) => {
|
}
|
||||||
this.addTerminalTab(session)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// this.newTab()
|
|
||||||
this.showSettings();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getToolbarButtons (aboveZero: boolean): IToolbarButton[] {
|
private getToolbarButtons (aboveZero: boolean): IToolbarButton[] {
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.form-group label {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
@ -2,6 +2,7 @@ import { Inject, Injectable } from '@angular/core'
|
|||||||
import { Logger, LogService } from 'services/log'
|
import { Logger, LogService } from 'services/log'
|
||||||
import { Tab } from 'api/tab'
|
import { Tab } from 'api/tab'
|
||||||
import { TabRecoveryProvider } from 'api/tabRecovery'
|
import { TabRecoveryProvider } from 'api/tabRecovery'
|
||||||
|
import { DefaultTabProvider } from 'api/defaultTabProvider'
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -13,6 +14,7 @@ export class AppService {
|
|||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
@Inject(TabRecoveryProvider) private tabRecoveryProviders: TabRecoveryProvider[],
|
@Inject(TabRecoveryProvider) private tabRecoveryProviders: TabRecoveryProvider[],
|
||||||
|
private defaultTabProvider: DefaultTabProvider,
|
||||||
log: LogService,
|
log: LogService,
|
||||||
) {
|
) {
|
||||||
this.logger = log.create('app')
|
this.logger = log.create('app')
|
||||||
@ -24,6 +26,10 @@ export class AppService {
|
|||||||
this.saveTabs()
|
this.saveTabs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openDefaultTab (): void {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
selectTab (tab) {
|
selectTab (tab) {
|
||||||
if (this.tabs.includes(this.activeTab)) {
|
if (this.tabs.includes(this.activeTab)) {
|
||||||
this.lastTabIndex = this.tabs.indexOf(this.activeTab)
|
this.lastTabIndex = this.tabs.indexOf(this.activeTab)
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
.line {
|
|
||||||
padding: 3px 10px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
.body(*ngIf='partialHotkeyMatches?.length > 0')
|
|
||||||
.line(*ngFor='let match of partialHotkeyMatches; trackBy: trackByFn', @animateLine)
|
|
||||||
hotkey-display([model]='match.strokes')
|
|
||||||
span {{ hotkeys.getHotkeyDescription(match.id).name }}
|
|
@ -1,70 +0,0 @@
|
|||||||
import { Component, Input, trigger, style, animate, transition, state } from '@angular/core'
|
|
||||||
import { HotkeysService, PartialHotkeyMatch } from 'services/hotkeys'
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'hotkey-hint',
|
|
||||||
template: require('./hotkeyHint.pug'),
|
|
||||||
styles: [require('./hotkeyHint.less')],
|
|
||||||
//changeDetection: ChangeDetectionStrategy.OnPush,
|
|
||||||
animations: [
|
|
||||||
trigger('animateLine', [
|
|
||||||
state('in', style({
|
|
||||||
'transform': 'translateX(0)',
|
|
||||||
'opacity': '1',
|
|
||||||
})),
|
|
||||||
transition(':enter', [
|
|
||||||
style({
|
|
||||||
'transform': 'translateX(25px)',
|
|
||||||
'opacity': '0',
|
|
||||||
}),
|
|
||||||
animate('250ms ease-out')
|
|
||||||
]),
|
|
||||||
transition(':leave', [
|
|
||||||
style({'height': '*'}),
|
|
||||||
animate('250ms ease-in', style({
|
|
||||||
'transform': 'translateX(25px)',
|
|
||||||
'opacity': '0',
|
|
||||||
'height': '0',
|
|
||||||
}))
|
|
||||||
])
|
|
||||||
])
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class HotkeyHintComponent {
|
|
||||||
@Input() partialHotkeyMatches: PartialHotkeyMatch[]
|
|
||||||
private keyTimeoutInterval: number = null
|
|
||||||
|
|
||||||
constructor (
|
|
||||||
public hotkeys: HotkeysService,
|
|
||||||
) {
|
|
||||||
this.hotkeys.key.subscribe(() => {
|
|
||||||
//console.log('Keystrokes', this.hotkeys.getCurrentKeystrokes())
|
|
||||||
let partialMatches = this.hotkeys.getCurrentPartiallyMatchedHotkeys()
|
|
||||||
if (partialMatches.length > 0) {
|
|
||||||
//console.log('Partial matches:', partialMatches)
|
|
||||||
this.setMatches(partialMatches)
|
|
||||||
|
|
||||||
if (this.keyTimeoutInterval == null) {
|
|
||||||
this.keyTimeoutInterval = window.setInterval(() => {
|
|
||||||
if (this.hotkeys.getCurrentPartiallyMatchedHotkeys().length == 0) {
|
|
||||||
clearInterval(this.keyTimeoutInterval)
|
|
||||||
this.keyTimeoutInterval = null
|
|
||||||
this.setMatches(null)
|
|
||||||
}
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.setMatches(null)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
setMatches (matches: PartialHotkeyMatch[]) {
|
|
||||||
this.partialHotkeyMatches = matches
|
|
||||||
}
|
|
||||||
|
|
||||||
trackByFn (_, item) {
|
|
||||||
return item && item.id
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
|||||||
|
|
||||||
import { HotkeyInputComponent } from './components/hotkeyInput'
|
import { HotkeyInputComponent } from './components/hotkeyInput'
|
||||||
import { HotkeyDisplayComponent } from './components/hotkeyDisplay'
|
import { HotkeyDisplayComponent } from './components/hotkeyDisplay'
|
||||||
import { HotkeyHintComponent } from './components/hotkeyHint'
|
|
||||||
import { HotkeyInputModalComponent } from './components/hotkeyInputModal'
|
import { HotkeyInputModalComponent } from './components/hotkeyInputModal'
|
||||||
import { MultiHotkeyInputComponent } from './components/multiHotkeyInput'
|
import { MultiHotkeyInputComponent } from './components/multiHotkeyInput'
|
||||||
import { SettingsPaneComponent } from './components/settingsPane'
|
import { SettingsPaneComponent } from './components/settingsPane'
|
||||||
@ -33,7 +32,6 @@ import { RecoveryProvider } from './recoveryProvider'
|
|||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
HotkeyDisplayComponent,
|
HotkeyDisplayComponent,
|
||||||
HotkeyHintComponent,
|
|
||||||
HotkeyInputComponent,
|
HotkeyInputComponent,
|
||||||
HotkeyInputModalComponent,
|
HotkeyInputModalComponent,
|
||||||
MultiHotkeyInputComponent,
|
MultiHotkeyInputComponent,
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
.appearance-preview(
|
.appearance-preview(
|
||||||
[style.font-family]='config.full().terminal.font',
|
[style.font-family]='config.full().terminal.font',
|
||||||
[style.font-size]='config.full().terminal.fontSize + "px"',
|
[style.font-size]='config.full().terminal.fontSize + "px"',
|
||||||
[style.background-color]='config.full().terminal.colorScheme.background',
|
[style.background-color]='(config.full().terminal.background == "theme") ? null : config.full().terminal.colorScheme.background',
|
||||||
[style.color]='config.full().terminal.colorScheme.foreground',
|
[style.color]='config.full().terminal.colorScheme.foreground',
|
||||||
)
|
)
|
||||||
div
|
div
|
||||||
@ -74,6 +74,26 @@
|
|||||||
)
|
)
|
||||||
option(*ngFor='let scheme of colorSchemes', [ngValue]='scheme') {{scheme.name}}
|
option(*ngFor='let scheme of colorSchemes', [ngValue]='scheme') {{scheme.name}}
|
||||||
|
|
||||||
|
.form-group
|
||||||
|
label Terminal background
|
||||||
|
div(
|
||||||
|
'[(ngModel)]'='config.store.terminal.background',
|
||||||
|
(ngModelChange)='config.save()',
|
||||||
|
ngbRadioGroup
|
||||||
|
)
|
||||||
|
label.btn.btn-secondary
|
||||||
|
input(
|
||||||
|
type='radio',
|
||||||
|
[value]='"theme"'
|
||||||
|
)
|
||||||
|
| From the app theme
|
||||||
|
label.btn.btn-secondary
|
||||||
|
input(
|
||||||
|
type='radio',
|
||||||
|
[value]='"colorScheme"'
|
||||||
|
)
|
||||||
|
| From the terminal colors
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label Terminal bell
|
label Terminal bell
|
||||||
br
|
br
|
||||||
|
@ -169,9 +169,14 @@ export class TerminalTabComponent extends BaseTabComponent<TerminalTab> {
|
|||||||
if (config.terminal.colorScheme.foreground) {
|
if (config.terminal.colorScheme.foreground) {
|
||||||
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)
|
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)
|
||||||
}
|
}
|
||||||
if (config.terminal.colorScheme.background) {
|
if (config.terminal.background == 'colorScheme') {
|
||||||
preferenceManager.set('background-color', config.terminal.colorScheme.background)
|
if (config.terminal.colorScheme.background) {
|
||||||
this.backgroundColor = config.terminal.colorScheme.background
|
this.backgroundColor = config.terminal.colorScheme.background
|
||||||
|
preferenceManager.set('background-color', config.terminal.colorScheme.background)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.backgroundColor = null
|
||||||
|
preferenceManager.set('background-color', 'transparent')
|
||||||
}
|
}
|
||||||
if (config.terminal.colorScheme.colors) {
|
if (config.terminal.colorScheme.colors) {
|
||||||
preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors)
|
preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors)
|
||||||
|
@ -8,6 +8,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
bell: 'off',
|
bell: 'off',
|
||||||
bracketedPaste: true,
|
bracketedPaste: true,
|
||||||
|
background: 'theme',
|
||||||
colorScheme: {
|
colorScheme: {
|
||||||
foreground: null,
|
foreground: null,
|
||||||
background: null,
|
background: null,
|
||||||
|
@ -85,7 +85,7 @@ title-bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
app-root .content {
|
app-root > .content {
|
||||||
background: $body-bg2;
|
background: $body-bg2;
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
|
Loading…
Reference in New Issue
Block a user