1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-01 18:14:02 +03:00
tabby/tabby-local/src/index.ts

90 lines
3.5 KiB
TypeScript
Raw Normal View History

import { NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
2021-07-04 13:23:27 +03:00
import TabbyCorePlugin, { HostAppService, ToolbarButtonProvider, TabRecoveryProvider, ConfigProvider, HotkeysService, HotkeyProvider, TabContextMenuItemProvider, CLIHandler, ConfigService, ProfileProvider } from 'tabby-core'
2021-06-30 00:57:04 +03:00
import TabbyTerminalModule from 'tabby-terminal'
import { SettingsTabProvider } from 'tabby-settings'
import { TerminalTabComponent } from './components/terminalTab.component'
import { ShellSettingsTabComponent } from './components/shellSettingsTab.component'
import { EnvironmentEditorComponent } from './components/environmentEditor.component'
2021-07-04 13:23:27 +03:00
import { LocalProfileSettingsComponent } from './components/localProfileSettings.component'
import { CommandLineEditorComponent } from './components/commandLineEditor.component'
import { TerminalService } from './services/terminal.service'
import { ButtonProvider } from './buttonProvider'
import { RecoveryProvider } from './recoveryProvider'
import { ShellSettingsTabProvider } from './settings'
import { TerminalConfigProvider } from './config'
2021-06-03 20:07:48 +03:00
import { LocalTerminalHotkeyProvider } from './hotkeys'
import { NewTabContextMenu, SaveAsProfileContextMenu } from './tabContextMenu'
import { AutoOpenTabCLIHandler, OpenPathCLIHandler, TerminalCLIHandler } from './cli'
2021-07-04 13:23:27 +03:00
import { LocalProfilesService } from './profiles'
/** @hidden */
@NgModule({
imports: [
CommonModule,
FormsModule,
NgbModule,
ToastrModule,
2021-06-30 00:57:04 +03:00
TabbyCorePlugin,
TabbyTerminalModule,
],
providers: [
{ provide: SettingsTabProvider, useClass: ShellSettingsTabProvider, multi: true },
{ provide: ToolbarButtonProvider, useClass: ButtonProvider, multi: true },
{ provide: TabRecoveryProvider, useClass: RecoveryProvider, multi: true },
{ provide: ConfigProvider, useClass: TerminalConfigProvider, multi: true },
2021-06-03 20:07:48 +03:00
{ provide: HotkeyProvider, useClass: LocalTerminalHotkeyProvider, multi: true },
2021-07-04 13:23:27 +03:00
{ provide: ProfileProvider, useClass: LocalProfilesService, multi: true },
{ provide: TabContextMenuItemProvider, useClass: NewTabContextMenu, multi: true },
{ provide: TabContextMenuItemProvider, useClass: SaveAsProfileContextMenu, multi: true },
{ provide: CLIHandler, useClass: TerminalCLIHandler, multi: true },
{ provide: CLIHandler, useClass: OpenPathCLIHandler, multi: true },
{ provide: CLIHandler, useClass: AutoOpenTabCLIHandler, multi: true },
],
declarations: [
TerminalTabComponent,
ShellSettingsTabComponent,
EnvironmentEditorComponent,
CommandLineEditorComponent,
2021-07-04 13:23:27 +03:00
LocalProfileSettingsComponent,
2021-07-14 01:03:05 +03:00
],
exports: [
TerminalTabComponent,
EnvironmentEditorComponent,
CommandLineEditorComponent,
],
})
export default class LocalTerminalModule { // eslint-disable-line @typescript-eslint/no-extraneous-class
private constructor (
hotkeys: HotkeysService,
terminal: TerminalService,
hostApp: HostAppService,
config: ConfigService,
) {
2021-07-05 23:52:32 +03:00
hotkeys.hotkey$.subscribe(async (hotkey) => {
if (hotkey === 'new-tab') {
terminal.openTab()
}
if (hotkey === 'new-window') {
hostApp.newWindow()
}
})
}
}
export { TerminalTabComponent }
2022-12-05 14:16:27 +03:00
export { TerminalService }
export * from './api'