mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-18 16:20:27 +08:00
option to auto-start a terminal tab (fixes #107)
This commit is contained in:
parent
fb64ca08d3
commit
38cda117e2
terminus-core/src
terminus-terminal/src
@ -150,6 +150,8 @@ export class AppRootComponent {
|
||||
if (this.app.tabs.length === 0) {
|
||||
this.app.openDefaultTab()
|
||||
}
|
||||
|
||||
this.app.emitReady()
|
||||
}
|
||||
|
||||
@HostListener('dragover')
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Subject } from 'rxjs'
|
||||
import { Subject, AsyncSubject } from 'rxjs'
|
||||
import { Injectable, ComponentFactoryResolver, Injector, Optional } from '@angular/core'
|
||||
import { DefaultTabProvider } from '../api/defaultTabProvider'
|
||||
import { BaseTabComponent } from '../components/baseTab.component'
|
||||
@ -12,7 +12,8 @@ export class AppService {
|
||||
activeTab: BaseTabComponent
|
||||
lastTabIndex = 0
|
||||
logger: Logger
|
||||
tabsChanged$ = new Subject()
|
||||
tabsChanged$ = new Subject<void>()
|
||||
ready$ = new AsyncSubject<void>()
|
||||
|
||||
constructor (
|
||||
private componentFactoryResolver: ComponentFactoryResolver,
|
||||
@ -97,4 +98,9 @@ export class AppService {
|
||||
}
|
||||
this.tabsChanged$.next()
|
||||
}
|
||||
|
||||
emitReady () {
|
||||
this.ready$.next(null)
|
||||
this.ready$.complete()
|
||||
}
|
||||
}
|
||||
|
@ -287,3 +287,26 @@
|
||||
*ngFor='let provider of persistenceProviders',
|
||||
[ngValue]='provider.id'
|
||||
) {{provider.displayName}}
|
||||
|
||||
.form-group
|
||||
label Auto-open a terminal on app start
|
||||
br
|
||||
div(
|
||||
'[(ngModel)]'='config.store.terminal.autoOpen',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='false'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='true'
|
||||
)
|
||||
| On
|
||||
|
@ -3,6 +3,7 @@ import { ConfigProvider, Platform } from 'terminus-core'
|
||||
export class TerminalConfigProvider extends ConfigProvider {
|
||||
defaults = {
|
||||
terminal: {
|
||||
autoOpen: false,
|
||||
fontSize: 14,
|
||||
linePadding: 0,
|
||||
bell: 'off',
|
||||
|
@ -3,7 +3,7 @@ import { BrowserModule } from '@angular/platform-browser'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
import { ToolbarButtonProvider, TabRecoveryProvider, ConfigProvider, HotkeysService, HotkeyProvider } from 'terminus-core'
|
||||
import { ToolbarButtonProvider, TabRecoveryProvider, ConfigProvider, HotkeysService, HotkeyProvider, AppService, ConfigService } from 'terminus-core'
|
||||
import { SettingsTabProvider } from 'terminus-settings'
|
||||
|
||||
import { TerminalTabComponent } from './components/terminalTab.component'
|
||||
@ -78,7 +78,12 @@ import { hterm } from './hterm'
|
||||
],
|
||||
})
|
||||
export default class TerminalModule {
|
||||
constructor (hotkeys: HotkeysService) {
|
||||
constructor (
|
||||
app: AppService,
|
||||
config: ConfigService,
|
||||
hotkeys: HotkeysService,
|
||||
terminal: TerminalService,
|
||||
) {
|
||||
let events = [
|
||||
{
|
||||
name: 'keydown',
|
||||
@ -103,6 +108,11 @@ export default class TerminalModule {
|
||||
hotkeys.emitKeyEvent(nativeEvent)
|
||||
}
|
||||
})
|
||||
if (config.store.terminal.autoOpen) {
|
||||
app.ready$.subscribe(() => {
|
||||
terminal.openTab()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user