diff --git a/app/src/plugins.ts b/app/src/plugins.ts index 21a4200f..474ef5d6 100644 --- a/app/src/plugins.ts +++ b/app/src/plugins.ts @@ -115,7 +115,7 @@ export async function findPlugins (): Promise { try { let info = JSON.parse(await fs.readFile(infoPath, {encoding: 'utf-8'})) - if (!info.keywords || info.keywords.indexOf('terminus-plugin') === -1) { + if (!info.keywords || !(info.keywords.includes('terminus-plugin') || info.keywords.includes('terminus-builtin-plugin'))) { continue } let author = info.author diff --git a/app/src/preload.scss b/app/src/preload.scss index 95742e57..b603b66a 100644 --- a/app/src/preload.scss +++ b/app/src/preload.scss @@ -58,3 +58,7 @@ color: #842fe0; } } + +.modal-dialog { + -webkit-app-region: no-drag; +} diff --git a/terminus-community-color-schemes/package.json b/terminus-community-color-schemes/package.json index 11cb2ce9..bb565f38 100644 --- a/terminus-community-color-schemes/package.json +++ b/terminus-community-color-schemes/package.json @@ -3,7 +3,7 @@ "version": "1.0.0-alpha.35", "description": "Community color schemes for Terminus", "keywords": [ - "terminus-plugin" + "terminus-builtin-plugin" ], "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/terminus-core/package.json b/terminus-core/package.json index b5e27914..257952ff 100644 --- a/terminus-core/package.json +++ b/terminus-core/package.json @@ -1,9 +1,9 @@ { "name": "terminus-core", - "version": "1.0.0-alpha.35", + "version": "1.0.0-alpha.35.1", "description": "Terminus core", "keywords": [ - "terminus-plugin" + "terminus-builtin-plugin" ], "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/terminus-plugin-manager/package.json b/terminus-plugin-manager/package.json index fd974d5a..50d8e32b 100644 --- a/terminus-plugin-manager/package.json +++ b/terminus-plugin-manager/package.json @@ -1,9 +1,9 @@ { "name": "terminus-plugin-manager", - "version": "1.0.0-alpha.35", + "version": "1.0.0-alpha.35.1", "description": "Terminus' plugin manager", "keywords": [ - "terminus-plugin" + "terminus-builtin-plugin" ], "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/terminus-plugin-manager/src/settings.ts b/terminus-plugin-manager/src/settings.ts index 062b4386..b9c0348f 100644 --- a/terminus-plugin-manager/src/settings.ts +++ b/terminus-plugin-manager/src/settings.ts @@ -5,6 +5,7 @@ import { PluginsSettingsTabComponent } from './components/pluginsSettingsTab.com @Injectable() export class PluginsSettingsTabProvider extends SettingsTabProvider { + id = 'plugins' title = 'Plugins' getComponentType (): ComponentType { diff --git a/terminus-settings/package.json b/terminus-settings/package.json index eafd0d77..001a375d 100644 --- a/terminus-settings/package.json +++ b/terminus-settings/package.json @@ -1,9 +1,9 @@ { "name": "terminus-settings", - "version": "1.0.0-alpha.35", + "version": "1.0.0-alpha.35.3", "description": "Terminus terminal settings page", "keywords": [ - "terminus-plugin" + "terminus-builtin-plugin" ], "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/terminus-settings/src/api.ts b/terminus-settings/src/api.ts index 675cd7de..9542ab22 100644 --- a/terminus-settings/src/api.ts +++ b/terminus-settings/src/api.ts @@ -3,6 +3,7 @@ import { Component } from '@angular/core' export declare type ComponentType = new (...args: any[]) => Component export abstract class SettingsTabProvider { + id: string title: string getComponentType (): ComponentType { diff --git a/terminus-settings/src/components/settingsTab.component.pug b/terminus-settings/src/components/settingsTab.component.pug index 2f68f6d0..df8ed239 100644 --- a/terminus-settings/src/components/settingsTab.component.pug +++ b/terminus-settings/src/components/settingsTab.component.pug @@ -1,7 +1,7 @@ button.btn.btn-outline-warning.btn-block(*ngIf='config.restartRequested', '(click)'='restartApp()') Restart the app to apply changes -ngb-tabset.vertical(type='tabs') - ngb-tab +ngb-tabset.vertical(type='tabs', [activeId]='activeTab') + ngb-tab(id='application') ng-template(ngbTabTitle) | Application ng-template(ngbTabContent) @@ -164,7 +164,7 @@ ngb-tabset.vertical(type='tabs') '(ngModelChange)'='config.save()', ) - ngb-tab + ngb-tab(id='hotkeys') ng-template(ngbTabTitle) | Hotkeys ng-template(ngbTabContent) @@ -184,7 +184,7 @@ ngb-tabset.vertical(type='tabs') '(modelChange)'='config.save(); docking.dock()' ) - ngb-tab(*ngFor='let provider of settingsProviders') + ngb-tab(*ngFor='let provider of settingsProviders', [id]='provider.id') ng-template(ngbTabTitle) | {{provider.title}} ng-template(ngbTabContent) diff --git a/terminus-settings/src/components/settingsTab.component.ts b/terminus-settings/src/components/settingsTab.component.ts index 00b83c93..cf9ef08b 100644 --- a/terminus-settings/src/components/settingsTab.component.ts +++ b/terminus-settings/src/components/settingsTab.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject } from '@angular/core' +import { Component, Inject, Input } from '@angular/core' import { ElectronService, DockingService, ConfigService, IHotkeyDescription, HotkeyProvider, BaseTabComponent, Theme, HostAppService } from 'terminus-core' import { SettingsTabProvider } from '../api' @@ -12,6 +12,7 @@ import { SettingsTabProvider } from '../api' ], }) export class SettingsTabComponent extends BaseTabComponent { + @Input() activeTab: string hotkeyFilter = '' private hotkeyDescriptions: IHotkeyDescription[] private screens diff --git a/terminus-settings/src/index.ts b/terminus-settings/src/index.ts index 8b9dd63e..da41cfc2 100644 --- a/terminus-settings/src/index.ts +++ b/terminus-settings/src/index.ts @@ -40,3 +40,4 @@ export default class SettingsModule { } export * from './api' +export { SettingsTabComponent } diff --git a/terminus-terminal/package.json b/terminus-terminal/package.json index 2776d6f5..327fe66c 100644 --- a/terminus-terminal/package.json +++ b/terminus-terminal/package.json @@ -1,9 +1,9 @@ { "name": "terminus-terminal", - "version": "1.0.0-alpha.35", + "version": "1.0.0-alpha.35.1", "description": "Terminus' terminal emulation core", "keywords": [ - "terminus-plugin" + "terminus-builtin-plugin" ], "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index 79bc16f5..8fbc38e3 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -60,23 +60,28 @@ export class TerminalTabComponent extends BaseTabComponent { this.decorators = this.decorators || [] this.title = 'Terminal' this.resize$.first().subscribe(async (resizeEvent) => { - this.session = this.sessions.addSession( - Object.assign({}, this.sessionOptions, resizeEvent) - ) + if (!this.session) { + this.session = this.sessions.addSession( + Object.assign({}, this.sessionOptions, resizeEvent) + ) + } + setTimeout(() => { this.session.resize(resizeEvent.width, resizeEvent.height) }, 1000) + // this.session.output$.bufferTime(10).subscribe((datas) => { this.session.output$.subscribe(data => { - // let data = datas.join('') this.zone.run(() => { this.output$.next(data) + this.write(data) }) - this.write(data) }) + this.sessionCloseSubscription = this.session.closed$.subscribe(() => { this.app.closeTab(this) }) + this.session.releaseInitialDataBuffer() }) this.hotkeysSubscription = this.hotkeys.matchedHotkey.subscribe(hotkey => { diff --git a/terminus-terminal/src/index.ts b/terminus-terminal/src/index.ts index 29cc1591..1d970ef7 100644 --- a/terminus-terminal/src/index.ts +++ b/terminus-terminal/src/index.ts @@ -10,7 +10,7 @@ import { TerminalTabComponent } from './components/terminalTab.component' import { TerminalSettingsTabComponent } from './components/terminalSettingsTab.component' import { ColorPickerComponent } from './components/colorPicker.component' -import { SessionsService } from './services/sessions.service' +import { SessionsService, BaseSession } from './services/sessions.service' import { TerminalService } from './services/terminal.service' import { ScreenPersistenceProvider } from './persistence/screen' @@ -117,4 +117,4 @@ export default class TerminalModule { } export * from './api' -export { TerminalService } +export { TerminalService, BaseSession, TerminalTabComponent } diff --git a/terminus-terminal/src/services/sessions.service.ts b/terminus-terminal/src/services/sessions.service.ts index 6dd6aa3c..a78e0b74 100644 --- a/terminus-terminal/src/services/sessions.service.ts +++ b/terminus-terminal/src/services/sessions.service.ts @@ -14,7 +14,7 @@ export interface IChildProcess { command: string } -export class Session { +export abstract class BaseSession { open: boolean name: string output$ = new Subject() @@ -22,11 +22,46 @@ export class Session { destroyed$ = new Subject() recoveryId: string truePID: number - private pty: any private initialDataBuffer = '' private initialDataBufferReleased = false + emitOutput (data: string) { + if (!this.initialDataBufferReleased) { + this.initialDataBuffer += data + } else { + this.output$.next(data) + } + } + + releaseInitialDataBuffer () { + this.initialDataBufferReleased = true + this.output$.next(this.initialDataBuffer) + this.initialDataBuffer = null + } + + abstract resize (columns, rows) + abstract write (data) + abstract kill (signal?: string) + abstract async getChildProcesses (): Promise + abstract async gracefullyKillProcess (): Promise + abstract async getWorkingDirectory (): Promise + + async destroy (): Promise { + if (this.open) { + this.open = false + this.closed$.next() + this.destroyed$.next() + this.output$.complete() + await this.gracefullyKillProcess() + } + } +} + +export class Session extends BaseSession { + private pty: any + constructor (options: SessionOptions) { + super() this.name = options.name this.recoveryId = options.recoveryId @@ -65,12 +100,8 @@ export class Session { this.open = true - this.pty.on('data', (data) => { - if (!this.initialDataBufferReleased) { - this.initialDataBuffer += data - } else { - this.output$.next(data) - } + this.pty.on('data', data => { + this.emitOutput(data) }) this.pty.on('exit', () => { @@ -86,12 +117,6 @@ export class Session { }) } - releaseInitialDataBuffer () { - this.initialDataBufferReleased = true - this.output$.next(this.initialDataBuffer) - this.initialDataBuffer = null - } - resize (columns, rows) { if (this.pty._writable) { this.pty.resize(columns, rows) @@ -144,16 +169,6 @@ export class Session { } } - async destroy (): Promise { - if (this.open) { - this.open = false - this.closed$.next() - this.destroyed$.next() - this.output$.complete() - await this.gracefullyKillProcess() - } - } - async getWorkingDirectory (): Promise { if (!this.truePID) { return null diff --git a/terminus-terminal/src/settings.ts b/terminus-terminal/src/settings.ts index 69b323f4..8a373be6 100644 --- a/terminus-terminal/src/settings.ts +++ b/terminus-terminal/src/settings.ts @@ -5,6 +5,7 @@ import { TerminalSettingsTabComponent } from './components/terminalSettingsTab.c @Injectable() export class TerminalSettingsTabProvider extends SettingsTabProvider { + id = 'terminal' title = 'Terminal' getComponentType (): ComponentType {