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