Compare commits

...

21 Commits

Author SHA1 Message Date
Eugene Pankov
49b90f15bc inherit session environment (fixes #119, fixes #125, fixes #124, fixes #129) 2017-07-20 23:32:17 +02:00
Eugene Pankov
5f5772501b apply styles on start and to the terminal iframe (fixes #134) 2017-07-20 23:09:04 +02:00
Eugene Pankov
ed0bfb39f3 fixes 2017-07-15 19:17:44 +02:00
Eugene Pankov
60ce10d1e3 tab renaming (fixes #19) 2017-07-15 19:11:49 +02:00
Eugene Pankov
e64126af37 bumped Angular 2017-07-15 19:07:41 +02:00
Eugene Pankov
19565fba2c re-enable Ctrl-S on Linux (fixes #111) 2017-07-15 18:33:53 +02:00
Eugene Pankov
f39443b0ff fix 2017-07-15 18:20:51 +02:00
Eugene Pankov
5dde5479d8 bump 2017-07-15 18:16:45 +02:00
Eugene Pankov
3d29b99ddf use yarn for plugin deps 2017-07-15 18:16:27 +02:00
Eugene Pankov
4ba7cf106f provide a fallback monospace font for characters missing in user's font (fixes #112) 2017-07-15 18:15:49 +02:00
Eugene Pankov
23c7acde51 fixed CLI paths on Windows (fixes #90) 2017-07-12 20:52:06 +02:00
Eugene Pankov
c41efbd62b quit properly (fixes #109) 2017-07-12 20:24:35 +02:00
Eugene Pankov
1643ca2bd5 Merge branch 'master' of https://github.com/Eugeny/terminus 2017-07-10 18:26:47 +02:00
Eugene Pankov
b640abd85d set proper $TERM on Windows (fixes #91, fixes #28) 2017-07-10 18:26:46 +02:00
Tri Nguyen
dcf9817075 update Base16 Default Dark theme to 256 colors 2017-07-10 18:12:44 +02:00
Eugene Pankov
6f8f83d178 detect 32-bit Cygwin setups (fixes #106) 2017-07-10 18:11:47 +02:00
Eugene Pankov
475c4f91be handle directory paths supplied on cli (fixes #90) 2017-07-10 17:57:58 +02:00
Eugene Pankov
29a6fb60de make middle mouse button close tabs (fixes #92) 2017-07-10 17:35:01 +02:00
Eugene Pankov
42007f4fef upgraded node-pty (fixes #84) 2017-07-10 17:30:42 +02:00
Eugene Pankov
92c0df7629 Merge branch 'master' of github.com:Eugeny/terminus 2017-07-10 15:30:51 +02:00
Eugene Pankov
e70cb25180 non-debug start script 2017-07-10 15:25:50 +02:00
33 changed files with 352 additions and 142 deletions

View File

@@ -30,28 +30,18 @@ if (!process.env.TERMINUS_PLUGINS) {
}
setupWindowManagement = () => {
let windowCloseable
app.window.on('show', () => {
app.window.webContents.send('host:window-shown')
})
app.window.on('close', (e) => {
windowConfig.set('windowBoundaries', app.window.getBounds())
if (!windowCloseable) {
app.window.minimize()
e.preventDefault()
}
})
app.window.on('closed', () => {
app.window = null
})
electron.ipcMain.on('window-closeable', (event, flag) => {
windowCloseable = flag
})
electron.ipcMain.on('window-focus', () => {
app.window.focus()
})
@@ -102,8 +92,6 @@ setupWindowManagement = () => {
electron.ipcMain.on('window-set-always-on-top', (event, flag) => {
app.window.setAlwaysOnTop(flag)
})
app.on('before-quit', () => windowCloseable = true)
}
@@ -131,7 +119,7 @@ setupMenu = () => {
label: 'Quit',
accelerator: 'Cmd+Q',
click () {
app.window.webContents.send('host:quit-request')
app.quit()
}
}
]

View File

@@ -12,14 +12,14 @@
"watch": "webpack --progress --color --watch"
},
"dependencies": {
"@angular/animations": "4.0.1",
"@angular/common": "4.0.1",
"@angular/compiler": "4.0.1",
"@angular/core": "4.0.1",
"@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"@angular/animations": "4.3.0",
"@angular/common": "4.3.0",
"@angular/compiler": "4.3.0",
"@angular/core": "4.3.0",
"@angular/forms": "4.3.0",
"@angular/platform-browser": "4.3.0",
"@angular/platform-browser-dynamic": "4.3.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.28",
"devtron": "1.4.0",
"electron-config": "0.2.1",
"electron-debug": "^1.0.1",
@@ -29,7 +29,7 @@
"mz": "^2.6.0",
"path": "0.12.7",
"rxjs": "5.3.0",
"zone.js": "0.8.4"
"zone.js": "0.8.12"
},
"devDependencies": {
"@types/mz": "0.0.31"

View File

@@ -12,7 +12,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
import { getRootModule } from './app.module'
import { findPlugins, loadPlugins } from './plugins'
if (process.platform == 'win32') {
if (process.platform === 'win32') {
process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH
}

View File

@@ -2,37 +2,51 @@
# yarn lockfile v1
"@angular/animations@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.0.1.tgz#154420c8ee5c22fbaf1434b6d156150cf5218da6"
"@angular/animations@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.3.0.tgz#56f34b84649379202ac359929b82eb0b915e9c72"
dependencies:
tslib "^1.7.1"
"@angular/common@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.0.1.tgz#df488eada842b2d841ded750712292b18387b5b0"
"@angular/common@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.3.0.tgz#13a54a6929dd52f9729b16ae446fad58fe163053"
dependencies:
tslib "^1.7.1"
"@angular/compiler@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.0.1.tgz#15721edb148167a2d83b6f9324817e658eac8280"
"@angular/compiler@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.3.0.tgz#55503bf27a1f062f71b9495393f3311903a8fc43"
dependencies:
tslib "^1.7.1"
"@angular/core@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.0.1.tgz#0b110a001012076ea696460ccd922707bcdf51ba"
"@angular/core@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.3.0.tgz#bd2249c3de1224a7c6536c4aba728d6565329334"
dependencies:
tslib "^1.7.1"
"@angular/forms@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.0.1.tgz#b9ebdbbb8ace0f9a3bf9e53c299eafdfab1d5041"
"@angular/forms@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.3.0.tgz#7d0c7a854737e9a30a5fd9665f8d4f56a1b91bd8"
dependencies:
tslib "^1.7.1"
"@angular/platform-browser-dynamic@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.0.1.tgz#fd5debb2d3f6474350965e71c2674e2170d7cfcb"
"@angular/platform-browser-dynamic@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.3.0.tgz#551fb18851b27ee8f3e4b0ee25aad10bd7b312e3"
dependencies:
tslib "^1.7.1"
"@angular/platform-browser@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.0.1.tgz#4b9efbeb2fbb900de188743b988802d3aa2b33ff"
"@angular/platform-browser@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.3.0.tgz#02389489185185c3becf06359346100e5479c7e1"
dependencies:
tslib "^1.7.1"
"@ng-bootstrap/ng-bootstrap@1.0.0-alpha.22":
version "1.0.0-alpha.22"
resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-1.0.0-alpha.22.tgz#aaad058cc39293ea6184e4b9b849f298c0b11a86"
"@ng-bootstrap/ng-bootstrap@^1.0.0-alpha.28":
version "1.0.0-alpha.28"
resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-1.0.0-alpha.28.tgz#30a6503bf7f94f9d3187591fb3267b59cc0cdaad"
"@types/mz@0.0.31":
version "0.0.31"
@@ -41,8 +55,8 @@
"@types/node" "*"
"@types/node@*":
version "8.0.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.7.tgz#fb0ad04b5b6f6eabe0372a32a8f1fbba5c130cae"
version "8.0.13"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.13.tgz#530f0f9254209b0335bf5cc6387822594ef47093"
accessibility-developer-tools@^2.11.0:
version "2.12.0"
@@ -244,12 +258,16 @@ thenify-all@^1.0.0:
dependencies:
any-promise "^1.0.0"
tslib@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec"
util@^0.10.3:
version "0.10.3"
resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9"
dependencies:
inherits "2.0.1"
zone.js@0.8.4:
version "0.8.4"
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.4.tgz#cc40ae5a1c879601c5ebba2096b5c80f0c4c3602"
zone.js@0.8.12:
version "0.8.12"
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.12.tgz#86ff5053c98aec291a0bf4bbac501d694a05cfbb"

View File

@@ -87,6 +87,7 @@
"build": "webpack --color --config app/webpack.config.js && webpack --color --config terminus-core/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-terminal/webpack.config.js && webpack --color --config terminus-settings/webpack.config.js && webpack --color --config terminus-plugin-manager/webpack.config.js && webpack --color --config terminus-community-color-schemes/webpack.config.js",
"watch": "webpack --progress --color --watch",
"start": "cross-env DEV=1 electron --js-flags='--ignition' app --debug",
"prod": "cross-env DEV=1 electron --js-flags='--ignition' app",
"lint": "tslint -c tslint.json -t stylish terminus-*/src/**/*.ts terminus-*/src/*.ts app/src/*.ts",
"postinstall": "install-app-deps"
},

View File

@@ -5,21 +5,18 @@ const vars = require('./vars')
const log = require('npmlog')
log.info('deps', 'app')
sh.exec('npm prune')
sh.exec('npm install')
sh.exec('npm update --dev')
sh.exec('yarn prune')
sh.exec('yarn install')
sh.cd('app')
sh.exec('npm prune')
sh.exec('npm install')
sh.exec('npm update --dev')
sh.exec('yarn prune')
sh.exec('yarn install')
sh.cd('..')
vars.builtinPlugins.forEach(plugin => {
log.info('deps', plugin)
sh.cd(plugin)
sh.exec('npm prune')
sh.exec('npm install')
sh.exec('npm update --dev')
sh.exec('yarn prune')
sh.exec('yarn install')
sh.cd('..')
})

View File

@@ -12,27 +12,27 @@
!
! Red
*.color1: #ab4642
*.color9: #dc9656
*.color9: #ab4642
!
! Green
*.color2: #a1b56c
*.color10: #282828
*.color10: #a1b56c
!
! Yellow
*.color3: #f7ca88
*.color11: #383838
*.color11: #f7ca88
!
! Blue
*.color4: #7cafc2
*.color12: #b8b8b8
*.color12: #7cafc2
!
! Magenta
*.color5: #ba8baf
*.color13: #e8e8e8
*.color13: #ba8baf
!
! Cyan
*.color6: #86c1b9
*.color14: #a16946
*.color14: #86c1b9
!
! White
*.color7: #d8d8d8

View File

@@ -17,14 +17,13 @@
"author": "Eugene Pankov",
"license": "MIT",
"devDependencies": {
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"@types/js-yaml": "^3.5.29",
"@types/node": "^7.0.12",
"@types/js-yaml": "^3.9.0",
"@types/node": "^7.0.37",
"@types/webpack-env": "^1.13.0",
"bootstrap": "4.0.0-alpha.6",
"core-js": "^2.4.1",
"ngx-perfect-scrollbar": "4.0.0",
"typescript": "^2.4.0"
"typescript": "^2.4.1"
},
"peerDependencies": {
"@angular/animations": "4.0.1",
@@ -37,8 +36,8 @@
"zone.js": "0.8.4"
},
"dependencies": {
"deepmerge": "^1.4.4",
"js-yaml": "^3.8.4"
"deepmerge": "^1.5.0",
"js-yaml": "^3.9.0"
},
"false": {}
}

View File

@@ -5,7 +5,6 @@ import { ElectronService } from '../services/electron.service'
import { HostAppService, Platform } from '../services/hostApp.service'
import { HotkeysService } from '../services/hotkeys.service'
import { Logger, LogService } from '../services/log.service'
import { QuitterService } from '../services/quitter.service'
import { ConfigService } from '../services/config.service'
import { DockingService } from '../services/docking.service'
import { TabRecoveryService } from '../services/tabRecovery.service'
@@ -28,9 +27,16 @@ import { AppService, IToolbarButton, ToolbarButtonProvider } from '../api'
'flex-basis': '1px',
'width': '1px',
}),
animate('250ms ease-in-out')
animate('250ms ease-in-out', style({
'flex-basis': '200px',
'width': '200px',
}))
]),
transition(':leave', [
style({
'flex-basis': '200px',
'width': '200px',
}),
animate('250ms ease-in-out', style({
'flex-basis': '1px',
'width': '1px',
@@ -57,7 +63,6 @@ export class AppRootComponent {
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
log: LogService,
_themes: ThemesService,
_quitter: QuitterService,
) {
this.logger = log.create('main')
this.logger.info('v', electron.app.getVersion())

View File

@@ -1,10 +1,11 @@
import { Subject, BehaviorSubject } from 'rxjs'
import { Subject } from 'rxjs'
import { ViewRef } from '@angular/core'
export abstract class BaseTabComponent {
private static lastTabID = 0
id: number
title$ = new BehaviorSubject<string>(null)
title: string
customTitle: string
scrollable: boolean
hasActivity = false
focused$ = new Subject<void>()
@@ -33,6 +34,5 @@ export abstract class BaseTabComponent {
destroy (): void {
this.focused$.complete()
this.blurred$.complete()
this.title$.complete()
}
}

View File

@@ -0,0 +1,6 @@
.modal-body
input.form-control(type='text', [(ngModel)]='value', (keyup.enter)='save()', autofocus)
.modal-footer
button.btn.btn-outline-primary((click)='save()') Save
button.btn.btn-outline-secondary((click)='close()') Cancel

View File

@@ -0,0 +1,22 @@
import { Component, Input } from '@angular/core'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
@Component({
selector: 'rename-tab-modal',
template: require('./renameTabModal.component.pug'),
})
export class RenameTabModalComponent {
@Input() value: string
constructor (
private modalInstance: NgbActiveModal
) { }
save () {
this.modalInstance.close(this.value)
}
close () {
this.modalInstance.dismiss()
}
}

View File

@@ -1,3 +1,3 @@
.index {{index + 1}}
.name {{tab.title$ | async}}
.name {{tab.customTitle || tab.title}}
button((click)='closeClicked.emit()') &times;

View File

@@ -1,5 +1,7 @@
import { Component, Input, Output, EventEmitter, HostBinding } from '@angular/core'
import { BaseTabComponent } from '../components/baseTab.component'
import { Component, Input, Output, EventEmitter, HostBinding, HostListener } from '@angular/core'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { BaseTabComponent } from './baseTab.component'
import { RenameTabModalComponent } from './renameTabModal.component'
@Component({
selector: 'tab-header',
@@ -12,4 +14,22 @@ export class TabHeaderComponent {
@Input() @HostBinding('class.has-activity') hasActivity: boolean
@Input() tab: BaseTabComponent
@Output() closeClicked = new EventEmitter()
constructor (
private ngbModal: NgbModal,
) { }
@HostListener('dblclick') onDoubleClick (): void {
let modal = this.ngbModal.open(RenameTabModalComponent)
modal.componentInstance.value = this.tab.customTitle || this.tab.title
modal.result.then(result => {
this.tab.customTitle = result
}).catch(() => null)
}
@HostListener('auxclick', ['$event']) onAuxClick ($event: MouseEvent): void {
if ($event.which === 2) {
this.closeClicked.emit()
}
}
}

View File

@@ -11,7 +11,6 @@ import { ElectronService } from './services/electron.service'
import { HostAppService } from './services/hostApp.service'
import { LogService } from './services/log.service'
import { HotkeysService, AppHotkeyProvider } from './services/hotkeys.service'
import { QuitterService } from './services/quitter.service'
import { DockingService } from './services/docking.service'
import { TabRecoveryService } from './services/tabRecovery.service'
import { ThemesService } from './services/themes.service'
@@ -22,6 +21,7 @@ import { StartPageComponent } from './components/startPage.component'
import { TabHeaderComponent } from './components/tabHeader.component'
import { TitleBarComponent } from './components/titleBar.component'
import { WindowControlsComponent } from './components/windowControls.component'
import { RenameTabModalComponent } from './components/renameTabModal.component'
import { HotkeyProvider } from './api/hotkeyProvider'
import { ConfigProvider } from './api/configProvider'
@@ -42,7 +42,6 @@ const PROVIDERS = [
LogService,
TabRecoveryService,
ThemesService,
QuitterService,
{ provide: HotkeyProvider, useClass: AppHotkeyProvider, multi: true },
{ provide: Theme, useClass: StandardTheme, multi: true },
{ provide: ConfigProvider, useClass: CoreConfigProvider, multi: true },
@@ -65,7 +64,11 @@ const PROVIDERS = [
TabHeaderComponent,
TitleBarComponent,
WindowControlsComponent,
RenameTabModalComponent,
],
entryComponents: [
RenameTabModalComponent,
]
})
export default class AppModule {
static forRoot (): ModuleWithProviders {

View File

@@ -9,12 +9,12 @@ export class ElectronService {
clipboard: any
globalShortcut: any
screen: any
remote: any
private electron: any
private remoteElectron: any
constructor () {
this.electron = require('electron')
this.remoteElectron = this.remoteRequire('electron')
this.remote = this.electron.remote
this.app = this.electron.remote.app
this.screen = this.electron.remote.screen
this.dialog = this.electron.remote.dialog
@@ -25,6 +25,6 @@ export class ElectronService {
}
remoteRequire (name: string): any {
return this.electron.remote.require(name)
return this.remote.require(name)
}
}

View File

@@ -18,7 +18,6 @@ export interface Bounds {
export class HostAppService {
platform: Platform
nodePlatform: string
quitRequested = new EventEmitter<any>()
preferencesMenu$ = new Subject<void>()
ready = new EventEmitter<any>()
shown = new EventEmitter<any>()
@@ -39,7 +38,6 @@ export class HostAppService {
linux: Platform.Linux
}[this.nodePlatform]
electron.ipcRenderer.on('host:quit-request', () => this.zone.run(() => this.quitRequested.emit()))
electron.ipcRenderer.on('host:preferences-menu', () => this.zone.run(() => this.preferencesMenu$.next()))
electron.ipcRenderer.on('uncaughtException', ($event, err) => {
@@ -79,10 +77,6 @@ export class HostAppService {
this.getWindow().webContents.openDevTools()
}
setCloseable (flag: boolean) {
this.electron.ipcRenderer.send('window-set-closeable', flag)
}
focusWindow () {
this.electron.ipcRenderer.send('window-focus')
}

View File

@@ -1,18 +0,0 @@
import { Injectable } from '@angular/core'
import { HostAppService } from '../services/hostApp.service'
@Injectable()
export class QuitterService {
constructor (
private hostApp: HostAppService,
) {
hostApp.quitRequested.subscribe(() => {
this.quit()
})
}
quit () {
this.hostApp.setCloseable(true)
this.hostApp.quit()
}
}

View File

@@ -13,7 +13,6 @@ export class ThemesService {
this.applyCurrentTheme()
config.changed$.subscribe(() => {
this.applyCurrentTheme()
document.querySelector('style#custom-css').innerHTML = config.store.appearance.css
})
}
@@ -32,6 +31,7 @@ export class ThemesService {
document.querySelector('head').appendChild(this.styleElement)
}
this.styleElement.textContent = theme.css
document.querySelector('style#custom-css').innerHTML = this.config.store.appearance.css
}
applyCurrentTheme (): void {

View File

@@ -23,6 +23,7 @@ $body-color: #aaa;
$font-family-sans-serif: "Source Sans Pro";
$font-size-base: 14rem / 16;
$btn-border-radius: 0;
$btn-secondary-color: #ccc;
$btn-secondary-bg: #222;
$btn-secondary-border: #444;

View File

@@ -19,10 +19,10 @@
"devDependencies": {
"@types/mz": "0.0.31",
"@types/node": "7.0.12",
"@types/semver": "^5.3.31",
"@types/semver": "^5.3.32",
"@types/webpack-env": "1.13.0",
"ngx-pipes": "^1.6.1",
"css-loader": "^0.28.0",
"ngx-pipes": "^1.6.1",
"semver": "^5.3.0"
},
"peerDependencies": {

View File

@@ -2,9 +2,9 @@ button.btn.btn-outline-warning.btn-block(*ngIf='config.restartRequested', '(clic
ngb-tabset.vertical(type='tabs')
ngb-tab
template(ngbTabTitle)
ng-template(ngbTabTitle)
| Application
template(ngbTabContent)
ng-template(ngbTabContent)
.row
.col.col-lg-6
.form-group
@@ -153,9 +153,9 @@ ngb-tabset.vertical(type='tabs')
)
ngb-tab
template(ngbTabTitle)
ng-template(ngbTabTitle)
| Hotkeys
template(ngbTabContent)
ng-template(ngbTabContent)
input.form-control(type='search', placeholder='Search hotkeys', [(ngModel)]='hotkeyFilter')
.form-group
table.hotkeys-table
@@ -173,7 +173,7 @@ ngb-tabset.vertical(type='tabs')
)
ngb-tab(*ngFor='let provider of settingsProviders')
template(ngbTabTitle)
ng-template(ngbTabTitle)
| {{provider.title}}
template(ngbTabContent)
ng-template(ngbTabContent)
settings-tab-body([provider]='provider')

View File

@@ -27,7 +27,7 @@ export class SettingsTabComponent extends BaseTabComponent {
) {
super()
this.hotkeyDescriptions = hotkeyProviders.map(x => x.hotkeys).reduce((a, b) => a.concat(b))
this.title$.next('Settings')
this.title = 'Settings'
this.scrollable = true
this.screens = this.docking.getScreens()
}

View File

@@ -23,7 +23,8 @@
"@types/webpack-env": "1.13.0",
"@types/winreg": "^1.2.30",
"dataurl": "0.1.0",
"deep-equal": "1.0.1"
"deep-equal": "1.0.1",
"file-loader": "^0.11.2"
},
"peerDependencies": {
"@angular/common": "4.0.1",
@@ -31,15 +32,16 @@
"@angular/forms": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.22",
"rxjs": "5.3.0",
"terminus-core": "*",
"terminus-settings": "*",
"rxjs": "5.3.0"
"terminus-settings": "*"
},
"dependencies": {
"font-manager": "0.2.2",
"hterm-umdjs": "1.2.0",
"hterm-umdjs": "1.1.3",
"mz": "^2.6.0",
"node-pty": "0.6.2",
"node-pty": "0.6.8",
"runes": "^0.4.2",
"winreg": "^1.2.3"
},
"false": {}

View File

@@ -1,7 +1,7 @@
import * as fs from 'mz/fs'
import * as path from 'path'
import { Injectable } from '@angular/core'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService } from 'terminus-core'
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, AppService, ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core'
import { SessionsService } from './services/sessions.service'
import { ShellsService } from './services/shells.service'
@@ -14,7 +14,8 @@ export class ButtonProvider extends ToolbarButtonProvider {
private sessions: SessionsService,
private config: ConfigService,
private shells: ShellsService,
hostApp: HostAppService,
private hostApp: HostAppService,
electron: ElectronService,
hotkeys: HotkeysService,
) {
super()
@@ -31,6 +32,18 @@ export class ButtonProvider extends ToolbarButtonProvider {
}
}
})
if (!electron.remote.process.env.DEV) {
setImmediate(async () => {
let argv: string[] = electron.remote.process.argv
for (let arg of argv.slice(1).concat([electron.remote.process.argv0])) {
if (await fs.exists(arg)) {
if ((await fs.stat(arg)).isDirectory()) {
this.openNewTab(arg)
}
}
}
})
}
}
async openNewTab (cwd?: string): Promise<void> {
@@ -38,14 +51,23 @@ export class ButtonProvider extends ToolbarButtonProvider {
cwd = await this.app.activeTab.session.getWorkingDirectory()
}
let command = this.config.store.terminal.shell
let args = []
let env: any = process.env
let args: string[] = []
if (command === '~clink~') {
({ command, args } = this.shells.getClinkOptions())
}
if (command === '~default-shell~') {
command = await this.shells.getDefaultShell()
}
let sessionOptions = await this.sessions.prepareNewSession({ command, args, cwd })
if (this.hostApp.platform === Platform.Windows) {
env.TERM = 'cygwin'
}
let sessionOptions = await this.sessions.prepareNewSession({
command,
args,
cwd,
env,
})
this.app.openNewTab(
TerminalTabComponent,
{ sessionOptions }

View File

@@ -68,11 +68,10 @@ export class TerminalSettingsTabComponent {
// Detect Cygwin
let cygwinPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup' })
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x64' })
reg.get('rootdir', (err, item) => {
if (err) {
resolve(null)
return
return resolve(null)
}
resolve(item.value)
})
@@ -81,6 +80,20 @@ export class TerminalSettingsTabComponent {
this.shells.push({ name: 'Cygwin', command: path.join(cygwinPath, 'bin', 'bash.exe') })
}
// Detect 32-bit Cygwin
let cygwin32Path = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x86' })
reg.get('rootdir', (err, item) => {
if (err) {
return resolve(null)
}
resolve(item.value)
})
})
if (cygwin32Path) {
this.shells.push({ name: 'Cygwin (32 bit)', command: path.join(cygwin32Path, 'bin', 'bash.exe') })
}
// Detect Git-Bash
let gitBashPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' })

View File

@@ -21,7 +21,6 @@ export class TerminalTabComponent extends BaseTabComponent {
@ViewChild('content') content
@HostBinding('style.background-color') backgroundColor: string
hterm: any
configSubscription: Subscription
sessionCloseSubscription: Subscription
hotkeysSubscription: Subscription
bell$ = new Subject()
@@ -47,10 +46,7 @@ export class TerminalTabComponent extends BaseTabComponent {
) {
super()
this.decorators = this.decorators || []
this.title$.next('Terminal')
this.configSubscription = config.changed$.subscribe(() => {
this.configure()
})
this.title = 'Terminal'
this.resize$.first().subscribe(async (resizeEvent) => {
this.session = this.sessions.addSession(
Object.assign({}, this.sessionOptions, resizeEvent)
@@ -99,6 +95,7 @@ export class TerminalTabComponent extends BaseTabComponent {
ngOnInit () {
this.focused$.subscribe(() => {
this.configure()
setTimeout(() => {
this.hterm.scrollPort_.resize()
this.hterm.scrollPort_.focus()
@@ -143,7 +140,7 @@ export class TerminalTabComponent extends BaseTabComponent {
attachHTermHandlers (hterm: any) {
hterm.setWindowTitle = (title) => {
this.zone.run(() => {
this.title$.next(title)
this.title = title
})
}
@@ -155,6 +152,8 @@ export class TerminalTabComponent extends BaseTabComponent {
hterm.primaryScreen_.syncSelectionCaret = () => null
hterm.alternateScreen_.syncSelectionCaret = () => null
hterm.primaryScreen_.terminal = hterm
hterm.alternateScreen_.terminal = hterm
const _onPaste = hterm.scrollPort_.onPaste_.bind(hterm.scrollPort_)
hterm.scrollPort_.onPaste_ = (event) => {
@@ -244,7 +243,7 @@ export class TerminalTabComponent extends BaseTabComponent {
async configure (): Promise<void> {
let config = this.config.store
preferenceManager.set('font-family', config.terminal.font)
preferenceManager.set('font-family', `"${config.terminal.font}", "monospace-fallback", monospace`)
this.setFontSize()
preferenceManager.set('enable-bold', true)
preferenceManager.set('audible-bell-sound', '')
@@ -292,6 +291,7 @@ export class TerminalTabComponent extends BaseTabComponent {
}
`
}
css += config.appearance.css
preferenceManager.set('user-css', dataurl.convert({
data: css,
mimetype: 'text/css',
@@ -320,7 +320,6 @@ export class TerminalTabComponent extends BaseTabComponent {
this.decorators.forEach(decorator => {
decorator.detach(this)
})
this.configSubscription.unsubscribe()
this.hotkeysSubscription.unsubscribe()
if (this.sessionCloseSubscription) {
this.sessionCloseSubscription.unsubscribe()

Binary file not shown.

View File

@@ -9,3 +9,8 @@ a:hover {
x-screen {
transition: 0.125s ease background;
}
@font-face {
font-family: "monospace-fallback";
src: url(fonts/Meslo.otf) format("opentype");
}

View File

@@ -89,6 +89,7 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
escape ^^^
vbell on
deflogin on
defflow off
term xterm-color
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line

View File

@@ -25,8 +25,8 @@ export class Session {
let env = {
...process.env,
...options.env,
TERM: 'xterm-256color',
...options.env,
}
if (process.platform === 'darwin' && !process.env.LC_ALL) {
@@ -66,6 +66,12 @@ export class Session {
}
})
this.pty.on('exit', () => {
if (this.open) {
this.destroy()
}
})
this.pty.on('close', () => {
if (this.open) {
this.destroy()

View File

@@ -34,6 +34,13 @@ module.exports = {
{ test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader",
options: {
limit: 999999999999,
}
},
]
},
externals: [

119
terminus-terminal/yarn.lock Normal file
View File

@@ -0,0 +1,119 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@types/deep-equal@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@types/deep-equal/-/deep-equal-1.0.0.tgz#9ebeaa73d1fc4791f038a5f1440e0449ea968495"
"@types/mz@0.0.31":
version "0.0.31"
resolved "https://registry.yarnpkg.com/@types/mz/-/mz-0.0.31.tgz#a4d80c082fefe71e40a7c0f07d1e6555bbbc7b52"
dependencies:
"@types/node" "*"
"@types/node@*", "@types/node@7.0.12":
version "7.0.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.12.tgz#ae5f67a19c15f752148004db07cbbb372e69efc9"
"@types/webpack-env@1.13.0":
version "1.13.0"
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.13.0.tgz#3044381647e11ee973c5af2e925323930f691d80"
"@types/winreg@^1.2.30":
version "1.2.30"
resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.30.tgz#91d6710e536d345b9c9b017c574cf6a8da64c518"
any-promise@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
big.js@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.1.3.tgz#4cada2193652eb3ca9ec8e55c9015669c9806978"
dataurl@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/dataurl/-/dataurl-0.1.0.tgz#1f4734feddec05ffe445747978d86759c4b33199"
deep-equal@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5"
emojis-list@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
file-loader@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.11.2.tgz#4ff1df28af38719a6098093b88c82c71d1794a34"
dependencies:
loader-utils "^1.0.2"
font-manager@0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/font-manager/-/font-manager-0.2.2.tgz#18a1c5b6ec7f91e22a17c71cbbaa0ea4e68e3a44"
dependencies:
nan "~2.2.0"
hterm-umdjs@1.1.3:
version "1.1.3+1.58.sha.15ed490"
resolved "https://registry.yarnpkg.com/hterm-umdjs/-/hterm-umdjs-1.1.3.tgz#8b57bcaded5ba9541d6c8e32a82b34abb93e885e"
json5@^0.5.0:
version "0.5.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
loader-utils@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd"
dependencies:
big.js "^3.1.3"
emojis-list "^2.0.0"
json5 "^0.5.0"
mz@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/mz/-/mz-2.6.0.tgz#c8b8521d958df0a4f2768025db69c719ee4ef1ce"
dependencies:
any-promise "^1.0.0"
object-assign "^4.0.1"
thenify-all "^1.0.0"
nan@2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8"
nan@~2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.2.1.tgz#d68693f6b34bb41d66bc68b3a4f9defc79d7149b"
node-pty@0.6.8:
version "0.6.8"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.6.8.tgz#a7b145397bef23a719128a75b20d4821726dfe90"
dependencies:
nan "2.5.0"
object-assign@^4.0.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
runes@^0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/runes/-/runes-0.4.2.tgz#1ddc1ea41de769cb32fc068a64fbbc45cd21052e"
thenify-all@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726"
dependencies:
thenify ">= 3.1.0 < 4"
"thenify@>= 3.1.0 < 4":
version "3.3.0"
resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839"
dependencies:
any-promise "^1.0.0"
winreg@^1.2.3:
version "1.2.4"
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"