2021-05-16 18:36:33 +03:00
|
|
|
import { NgModule } from '@angular/core'
|
|
|
|
import { BrowserModule } from '@angular/platform-browser'
|
|
|
|
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 TabbyElectronPlugin from 'tabby-electron'
|
|
|
|
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 { DockMenuService } from './services/dockMenu.service'
|
|
|
|
|
|
|
|
import { ButtonProvider } from './buttonProvider'
|
|
|
|
import { RecoveryProvider } from './recoveryProvider'
|
|
|
|
import { ShellProvider } from './api'
|
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'
|
2021-05-16 18:36:33 +03:00
|
|
|
import { NewTabContextMenu, SaveAsProfileContextMenu } from './tabContextMenu'
|
|
|
|
|
|
|
|
import { CmderShellProvider } from './shells/cmder'
|
|
|
|
import { Cygwin32ShellProvider } from './shells/cygwin32'
|
|
|
|
import { Cygwin64ShellProvider } from './shells/cygwin64'
|
|
|
|
import { GitBashShellProvider } from './shells/gitBash'
|
|
|
|
import { LinuxDefaultShellProvider } from './shells/linuxDefault'
|
|
|
|
import { MacOSDefaultShellProvider } from './shells/macDefault'
|
2021-09-03 00:52:31 +03:00
|
|
|
import { MSYS2ShellProvider } from './shells/msys2'
|
2021-05-16 18:36:33 +03:00
|
|
|
import { POSIXShellsProvider } from './shells/posix'
|
|
|
|
import { PowerShellCoreShellProvider } from './shells/powershellCore'
|
|
|
|
import { WindowsDefaultShellProvider } from './shells/winDefault'
|
|
|
|
import { WindowsStockShellsProvider } from './shells/windowsStock'
|
|
|
|
import { WSLShellProvider } from './shells/wsl'
|
2021-07-06 20:33:53 +03:00
|
|
|
import { VSDevToolsProvider } from './shells/vs'
|
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: [
|
|
|
|
BrowserModule,
|
|
|
|
FormsModule,
|
|
|
|
NgbModule,
|
|
|
|
ToastrModule,
|
2021-06-30 00:57:04 +03:00
|
|
|
TabbyCorePlugin,
|
|
|
|
TabbyElectronPlugin,
|
|
|
|
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
|
|
|
|
|
|
|
{ provide: ShellProvider, useClass: WindowsDefaultShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: PowerShellCoreShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: CmderShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: Cygwin32ShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: Cygwin64ShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
|
|
|
|
{ provide: ShellProvider, useClass: POSIXShellsProvider, multi: true },
|
2021-09-03 00:52:31 +03:00
|
|
|
{ provide: ShellProvider, useClass: MSYS2ShellProvider, multi: true },
|
2021-05-16 18:36:33 +03:00
|
|
|
{ provide: ShellProvider, useClass: WSLShellProvider, multi: true },
|
2021-07-06 20:33:53 +03:00
|
|
|
{ provide: ShellProvider, useClass: VSDevToolsProvider, 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: TabContextMenuItemProvider, useClass: SaveAsProfileContextMenu, multi: true },
|
|
|
|
|
|
|
|
{ provide: CLIHandler, useClass: TerminalCLIHandler, multi: true },
|
|
|
|
{ provide: CLIHandler, useClass: OpenPathCLIHandler, multi: true },
|
|
|
|
{ provide: CLIHandler, useClass: AutoOpenTabCLIHandler, multi: true },
|
|
|
|
|
|
|
|
// For WindowsDefaultShellProvider
|
|
|
|
PowerShellCoreShellProvider,
|
|
|
|
WSLShellProvider,
|
|
|
|
WindowsStockShellsProvider,
|
|
|
|
],
|
|
|
|
entryComponents: [
|
|
|
|
TerminalTabComponent,
|
|
|
|
ShellSettingsTabComponent,
|
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
|
|
|
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,
|
|
|
|
dockMenu: DockMenuService,
|
2021-05-24 18:48:12 +03:00
|
|
|
config: ConfigService,
|
2021-05-16 18:36:33 +03:00
|
|
|
) {
|
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()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-05-24 18:48:12 +03:00
|
|
|
config.ready$.toPromise().then(() => {
|
|
|
|
dockMenu.update()
|
|
|
|
})
|
2021-05-16 18:36:33 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { TerminalTabComponent }
|
2022-12-05 14:16:27 +03:00
|
|
|
export { TerminalService }
|
2021-05-16 18:36:33 +03:00
|
|
|
export * from './api'
|