mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-30 14:14:35 +00:00
Compare commits
39 Commits
v1.0.0-alp
...
v1.0.0-alp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7c03b62ea3 | ||
![]() |
950f071737 | ||
![]() |
9706c1079e | ||
![]() |
9c6f2747aa | ||
![]() |
1eb2dfd1b6 | ||
![]() |
c0df8f4d41 | ||
![]() |
1e902d734f | ||
![]() |
59a3c9aeb6 | ||
![]() |
21a2fa6da5 | ||
![]() |
42584e1116 | ||
![]() |
7bfc13dae5 | ||
![]() |
7cb6642f1e | ||
![]() |
f011b03fb2 | ||
![]() |
c0d8709a4c | ||
![]() |
5d605a4853 | ||
![]() |
1d69082e6c | ||
![]() |
4d91027b2c | ||
![]() |
86a21c03d2 | ||
![]() |
51950b816f | ||
![]() |
d3a192da58 | ||
![]() |
4b30dfef58 | ||
![]() |
8432e3ef66 | ||
![]() |
cdfd84a7f8 | ||
![]() |
128fe24003 | ||
![]() |
30f221d05e | ||
![]() |
5087224017 | ||
![]() |
9a8bad4851 | ||
![]() |
c3c983daf6 | ||
![]() |
dce8647f55 | ||
![]() |
f947fe3f0f | ||
![]() |
b5f96a59f8 | ||
![]() |
c90a5678cf | ||
![]() |
663da34e6d | ||
![]() |
049f08b8f9 | ||
![]() |
3c3b14bf09 | ||
![]() |
5e07dd5442 | ||
![]() |
8f2d2cbe30 | ||
![]() |
bebde4799d | ||
![]() |
9cedeb3efb |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ npm-debug.log
|
||||
|
||||
builtin-plugins
|
||||
package-lock.json
|
||||
yarn-error.log
|
||||
|
16
README.md
16
README.md
@@ -16,18 +16,16 @@
|
||||
|
||||

|
||||
|
||||
**Terminus** is a web technology based terminal heavily inspired by Hyper. It is, however, designed for people who need to get things done.
|
||||
**Terminus** is a terminal heavily inspired by Hyper. It is, however, designed for people who need to get things done.
|
||||
|
||||
* Runs on Windows, macOS and Linux
|
||||
* Theming and color schemes
|
||||
* Configurable hotkey schemes
|
||||
* **GNU Screen** style hotkeys available by default
|
||||
* Fully configurable shortcuts
|
||||
* Full Unicode support including double-width characters
|
||||
* Doesn't choke on fast-flowing outputs
|
||||
* Proper shell-like experience on Windows including tab completion (via Clink)
|
||||
* CMD, PowerShell, PowerShell Core, Cygwin, Cmder, Git-Bash and WSL (Bash on Windows) support
|
||||
* Tab persistence on macOS and Linux
|
||||
* Proper shell-like experience on Windows including tab completion (thanks, Clink!)
|
||||
* CMD, PowerShell, Cygwin, Git-Bash and Bash on Windows support
|
||||
* Default Linux style hotkeys for copy (`Ctrl`+`Shift`+`C`) and paste (`Ctrl`+`Shift`+`V`)
|
||||
|
||||
---
|
||||
|
||||
@@ -38,15 +36,17 @@ Plugins can be installed directly from the Settings view inside Terminus.
|
||||
* [clickable-links](https://github.com/Eugeny/terminus-clickable-links) - makes paths and URLs in the terminal clickable
|
||||
* [theme-hype](https://github.com/Eugeny/terminus-theme-hype) - a Hyper inspired theme
|
||||
* [shell-selector](https://github.com/Eugeny/terminus-shell-selector) - a quick shell selector pane
|
||||
* [title-control](https://github.com/kbjr/terminus-scrollbar) - allows modifying the title of the terminal tabs by providing a prefix, suffix, and/or strings to be removed
|
||||
* [scrollbar](https://github.com/kbjr/terminus-scrollbar) - adds a scrollbar to terminal tabs
|
||||
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
Pull requests and plugins are welcome! Publish your plugin on NPM with a `terminus-plugin` keyword to make them appear in the Plugin Manager.
|
||||
Pull requests and plugins are welcome! Publish your plugin on NPM with a `terminus-plugin` keyword to make it appear in the Plugin Manager.
|
||||
|
||||
See [HACKING.md](https://github.com/Eugeny/terminus/blob/master/HACKING.md) for a very brief plugin development tutorial!
|
||||
|
||||
|
||||
## License
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus?ref=badge_large)
|
||||
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FEugeny%2Fterminus?ref=badge_large)
|
||||
|
50
app/bufferizedPTY.js
Normal file
50
app/bufferizedPTY.js
Normal file
@@ -0,0 +1,50 @@
|
||||
module.exports = function patchPTYModule (path) {
|
||||
const mod = require(path)
|
||||
const oldSpawn = mod.spawn
|
||||
if (mod.patched) {
|
||||
return mod
|
||||
}
|
||||
mod.patched = true
|
||||
mod.spawn = (file, args, opt) => {
|
||||
let terminal = oldSpawn(file, args, opt)
|
||||
let timeout = null
|
||||
let buffer = ''
|
||||
let lastFlush = 0
|
||||
let nextTimeout = 0
|
||||
|
||||
const maxWindow = 250
|
||||
const minWindow = 50
|
||||
|
||||
function flush () {
|
||||
if (buffer) {
|
||||
terminal.emit('data-buffered', buffer)
|
||||
}
|
||||
lastFlush = Date.now()
|
||||
buffer = ''
|
||||
}
|
||||
|
||||
function reschedule () {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout)
|
||||
}
|
||||
nextTimeout = Date.now() + minWindow
|
||||
timeout = setTimeout(() => {
|
||||
timeout = null
|
||||
flush()
|
||||
}, minWindow)
|
||||
}
|
||||
|
||||
terminal.on('data', data => {
|
||||
buffer += data
|
||||
if (Date.now() - lastFlush > maxWindow) {
|
||||
flush()
|
||||
} else {
|
||||
if (Date.now() > nextTimeout - (minWindow / 10)) {
|
||||
reschedule()
|
||||
}
|
||||
}
|
||||
})
|
||||
return terminal
|
||||
}
|
||||
return mod
|
||||
}
|
16
app/main.js
16
app/main.js
@@ -1,11 +1,9 @@
|
||||
if (process.platform == 'win32' && require('electron-squirrel-startup')) process.exit(0)
|
||||
|
||||
const electron = require('electron')
|
||||
if (process.argv.indexOf('--debug') !== -1) {
|
||||
require('electron-debug')({enabled: true, showDevTools: 'undocked'})
|
||||
}
|
||||
|
||||
|
||||
let app = electron.app
|
||||
|
||||
let secondInstance = app.makeSingleInstance((argv, cwd) => {
|
||||
@@ -44,6 +42,9 @@ setupWindowManagement = () => {
|
||||
}
|
||||
})
|
||||
|
||||
app.window.on('enter-full-screen', () => app.window.webContents.send('host:window-enter-full-screen'))
|
||||
app.window.on('leave-full-screen', () => app.window.webContents.send('host:window-leave-full-screen'))
|
||||
|
||||
app.window.on('close', (e) => {
|
||||
windowConfig.set('windowBoundaries', app.window.getBounds())
|
||||
})
|
||||
@@ -56,14 +57,6 @@ setupWindowManagement = () => {
|
||||
app.window.focus()
|
||||
})
|
||||
|
||||
electron.ipcMain.on('window-toggle-focus', () => {
|
||||
if (app.window.isFocused()) {
|
||||
app.window.minimize()
|
||||
} else {
|
||||
app.window.focus()
|
||||
}
|
||||
})
|
||||
|
||||
electron.ipcMain.on('window-maximize', () => {
|
||||
app.window.maximize()
|
||||
})
|
||||
@@ -183,7 +176,6 @@ setupMenu = () => {
|
||||
{
|
||||
role: 'window',
|
||||
submenu: [
|
||||
{role: 'close'},
|
||||
{role: 'minimize'},
|
||||
{role: 'zoom'},
|
||||
{type: 'separator'},
|
||||
@@ -233,7 +225,7 @@ start = () => {
|
||||
options.frame = true
|
||||
} else {
|
||||
if (process.platform == 'darwin') {
|
||||
options.titleBarStyle = 'hidden-inset'
|
||||
options.titleBarStyle = 'hiddenInset'
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,14 +12,14 @@
|
||||
"watch": "webpack --progress --color --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@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-beta.2",
|
||||
"@angular/animations": "6.0.2",
|
||||
"@angular/common": "6.0.2",
|
||||
"@angular/compiler": "6.0.2",
|
||||
"@angular/core": "6.0.2",
|
||||
"@angular/forms": "6.0.2",
|
||||
"@angular/platform-browser": "6.0.2",
|
||||
"@angular/platform-browser-dynamic": "6.0.2",
|
||||
"@ng-bootstrap/ng-bootstrap": "^2.0.0",
|
||||
"devtron": "1.4.0",
|
||||
"electron-config": "0.2.1",
|
||||
"electron-debug": "^1.0.1",
|
||||
@@ -27,10 +27,10 @@
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"js-yaml": "3.8.2",
|
||||
"mz": "^2.6.0",
|
||||
"ngx-toastr": "^8.0.0",
|
||||
"ngx-toastr": "^8.7.3",
|
||||
"path": "0.12.7",
|
||||
"rxjs": "5.3.0",
|
||||
"zone.js": "0.8.12"
|
||||
"rxjs": "^6.1.0",
|
||||
"zone.js": "~0.8.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mz": "0.0.31"
|
||||
|
@@ -2,6 +2,7 @@ import 'zone.js'
|
||||
import 'core-js/es7/reflect'
|
||||
import 'core-js/core/delay'
|
||||
import 'rxjs'
|
||||
import './toastr.scss'
|
||||
|
||||
// Always land on the start view
|
||||
location.hash = ''
|
||||
|
@@ -61,6 +61,7 @@ const builtinModules = [
|
||||
'@ng-bootstrap/ng-bootstrap',
|
||||
'ngx-toastr',
|
||||
'rxjs',
|
||||
'rxjs/operators',
|
||||
'terminus-core',
|
||||
'terminus-settings',
|
||||
'terminus-terminal',
|
||||
|
@@ -59,6 +59,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
.modal-dialog, .modal-backdrop {
|
||||
-webkit-app-region: no-drag;
|
||||
}
|
||||
|
||||
[ngbradiogroup] input[type="radio"] {
|
||||
display: none;
|
||||
}
|
||||
|
16
app/src/toastr.scss
Normal file
16
app/src/toastr.scss
Normal file
@@ -0,0 +1,16 @@
|
||||
#toast-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.toast {
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,.25);
|
||||
padding: 10px;
|
||||
background-image: none;
|
||||
width: auto;
|
||||
|
||||
&.toast-info {
|
||||
background-color: #555;
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,28 +21,34 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
}
|
||||
}
|
||||
},
|
||||
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
|
||||
{ test: /\.css$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
|
||||
{
|
||||
test: /\.(png|svg)$/,
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: 'images/[name].[ext]'
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'images/[name].[ext]'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: 'fonts/[name].[ext]'
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'fonts/[name].[ext]'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -2,51 +2,51 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@angular/animations@4.3.0":
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.3.0.tgz#56f34b84649379202ac359929b82eb0b915e9c72"
|
||||
"@angular/animations@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-6.0.2.tgz#92063f612c3b33d962eddc9ad538cadd231fbe47"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/common@4.3.0":
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.3.0.tgz#13a54a6929dd52f9729b16ae446fad58fe163053"
|
||||
"@angular/common@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/common/-/common-6.0.2.tgz#e4cbb7d45d8d2f35e918d62f0cbfd8c87e9168f7"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/compiler@4.3.0":
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.3.0.tgz#55503bf27a1f062f71b9495393f3311903a8fc43"
|
||||
"@angular/compiler@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-6.0.2.tgz#b9d29b7e032c767179967540f1ed7f8777a615a1"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/core@4.3.0":
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.3.0.tgz#bd2249c3de1224a7c6536c4aba728d6565329334"
|
||||
"@angular/core@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/core/-/core-6.0.2.tgz#d183730d73182a4590a5d71083db45655f210e69"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@angular/forms@4.3.0":
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.3.0.tgz#7d0c7a854737e9a30a5fd9665f8d4f56a1b91bd8"
|
||||
"@angular/forms@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-6.0.2.tgz#a0647930e8b6e7fbd48f55eb69b399a41bcd091a"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@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"
|
||||
"@angular/platform-browser-dynamic@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-6.0.2.tgz#755689df9f02bbcb270c7872a75a2ffe7e0b0c33"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@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"
|
||||
"@angular/platform-browser@6.0.2":
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-6.0.2.tgz#19f56f6efbd0e7af5f35fe2f8cde3557dc8ba689"
|
||||
dependencies:
|
||||
tslib "^1.7.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
"@ng-bootstrap/ng-bootstrap@^1.0.0-beta.2":
|
||||
version "1.0.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-1.0.0-beta.2.tgz#3d4b567b0334a9ee631b73c72156cd3a9d3cd29f"
|
||||
"@ng-bootstrap/ng-bootstrap@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-2.0.0.tgz#65f78c7dd5a8ac424f44bb2050a9eab247cdeb0c"
|
||||
|
||||
"@types/mz@0.0.31":
|
||||
version "0.0.31"
|
||||
@@ -195,9 +195,11 @@ mz@^2.6.0:
|
||||
object-assign "^4.0.1"
|
||||
thenify-all "^1.0.0"
|
||||
|
||||
ngx-toastr@^8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ngx-toastr/-/ngx-toastr-8.0.0.tgz#f3bc53146b2f7da3eabf3daa1b1bbdf65cb49697"
|
||||
ngx-toastr@^8.7.3:
|
||||
version "8.7.3"
|
||||
resolved "https://registry.yarnpkg.com/ngx-toastr/-/ngx-toastr-8.7.3.tgz#d3b7a8077ba1c860dd8a44779ccad38c5ea15c92"
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
object-assign@^4.0.1:
|
||||
version "4.1.1"
|
||||
@@ -236,20 +238,16 @@ process@^0.11.1:
|
||||
version "0.11.10"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
|
||||
|
||||
rxjs@5.3.0:
|
||||
version "5.3.0"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.3.0.tgz#d88ccbdd46af290cbdb97d5d8055e52453fabe2d"
|
||||
rxjs@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.1.0.tgz#833447de4e4f6427b9cec3e5eb9f56415cd28315"
|
||||
dependencies:
|
||||
symbol-observable "^1.0.1"
|
||||
tslib "^1.9.0"
|
||||
|
||||
sprintf-js@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
|
||||
symbol-observable@^1.0.1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d"
|
||||
|
||||
thenify-all@^1.0.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726"
|
||||
@@ -262,9 +260,9 @@ 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"
|
||||
tslib@^1.9.0:
|
||||
version "1.9.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.1.tgz#a5d1f0532a49221c87755cfcc89ca37197242ba7"
|
||||
|
||||
util@^0.10.3:
|
||||
version "0.10.3"
|
||||
@@ -272,6 +270,6 @@ util@^0.10.3:
|
||||
dependencies:
|
||||
inherits "2.0.1"
|
||||
|
||||
zone.js@0.8.12:
|
||||
version "0.8.12"
|
||||
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.12.tgz#86ff5053c98aec291a0bf4bbac501d694a05cfbb"
|
||||
zone.js@~0.8.26:
|
||||
version "0.8.26"
|
||||
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.8.26.tgz#7bdd72f7668c5a7ad6b118148b4ea39c59d08d2d"
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 106 KiB |
92
build/windows/icon.svg
Normal file
92
build/windows/icon.svg
Normal file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="1024"
|
||||
height="1024"
|
||||
viewBox="0 0 270.93332 270.93333"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:export-filename="D:\Users\Ich\Downloads\64x64.png"
|
||||
inkscape:export-xdpi="6"
|
||||
inkscape:export-ydpi="6">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.35355339"
|
||||
inkscape:cx="-57.249603"
|
||||
inkscape:cy="781.4887"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:window-width="1858"
|
||||
inkscape:window-height="1050"
|
||||
inkscape:window-x="54"
|
||||
inkscape:window-y="1079"
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:object-paths="true"
|
||||
units="px" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-47.511065,70.941737)">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path138"
|
||||
style="opacity:0.9;fill:#bfd9f1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.43524027px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="M 64.949149,-45.402272 213.30911,40.153203 168.74736,65.880709 64.949181,2.5692907 Z"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path116"
|
||||
style="opacity:0.9;fill:#6666af;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.43524027px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="m 301.0092,42.179959 -0.003,50.177506 -190.42255,107.635545 -0.003,-48.17143 z"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path118"
|
||||
style="opacity:0.9;fill:#bfd9f1;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.43524027px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="m 64.948697,125.47711 45.629963,26.34447 0.005,48.17143 -45.637407,-26.50135 z"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
style="opacity:0.9;fill:#9dbef0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.44854069px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="M 105.39355,-70.939125 64.949149,-45.402272 213.30911,40.153203 64.948697,125.47711 110.57866,151.82158 260.4947,65.557719 301.0092,42.179959 Z"
|
||||
id="path134"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
26
package.json
26
package.json
@@ -5,33 +5,33 @@
|
||||
"@types/node": "7.0.5",
|
||||
"@types/webpack-env": "1.13.0",
|
||||
"apply-loader": "0.1.0",
|
||||
"awesome-typescript-loader": "3.1.2",
|
||||
"awesome-typescript-loader": "^5.0.0",
|
||||
"core-js": "2.4.1",
|
||||
"cross-env": "4.0.0",
|
||||
"css-loader": "0.28.0",
|
||||
"electron": "1.8.4",
|
||||
"electron": "2.0.0",
|
||||
"electron-builder": "17.1.1",
|
||||
"electron-builder-squirrel-windows": "17.0.1",
|
||||
"electron-rebuild": "1.5.11",
|
||||
"file-loader": "0.9.0",
|
||||
"electron-rebuild": "^1.7.3",
|
||||
"file-loader": "^1.1.11",
|
||||
"font-awesome": "4.7.0",
|
||||
"graceful-fs": "^4.1.11",
|
||||
"html-loader": "0.4.4",
|
||||
"json-loader": "0.5.4",
|
||||
"less": "2.7.1",
|
||||
"less-loader": "2.2.3",
|
||||
"node-abi": "2.0.3",
|
||||
"node-abi": "^2.4.1",
|
||||
"node-gyp": "^3.6.2",
|
||||
"node-sass": "^4.5.3",
|
||||
"npmlog": "4.1.0",
|
||||
"npx": "^9.7.1",
|
||||
"pug": "2.0.0-beta11",
|
||||
"pug": "^2.0.3",
|
||||
"pug-html-loader": "1.0.9",
|
||||
"pug-loader": "2.3.0",
|
||||
"pug-loader": "^2.4.0",
|
||||
"pug-static-loader": "0.0.1",
|
||||
"raven-js": "3.16.0",
|
||||
"raw-loader": "0.5.1",
|
||||
"sass-loader": "6.0.3",
|
||||
"sass-loader": "^7.0.1",
|
||||
"shelljs": "0.7.7",
|
||||
"source-sans-pro": "2.0.10",
|
||||
"style-loader": "0.13.1",
|
||||
@@ -39,10 +39,11 @@
|
||||
"tslint": "5.1.0",
|
||||
"tslint-config-standard": "5.0.2",
|
||||
"tslint-eslint-rules": "4.0.0",
|
||||
"typescript": "2.2.2",
|
||||
"typescript": "^2.8.3",
|
||||
"url-loader": "0.5.7",
|
||||
"val-loader": "0.5.0",
|
||||
"webpack": "^3.0.0",
|
||||
"webpack": "^4.8.3",
|
||||
"webpack-cli": "^2.1.3",
|
||||
"yaml-loader": "0.4.0",
|
||||
"yarn": "^1.3.2"
|
||||
},
|
||||
@@ -91,7 +92,6 @@
|
||||
"libappindicator1",
|
||||
"libxtst6",
|
||||
"libnss3",
|
||||
"python-gnomekeyring",
|
||||
"tmux"
|
||||
],
|
||||
"artifactName": "terminus-${version}-${os}-${arch}.deb"
|
||||
@@ -107,8 +107,8 @@
|
||||
"scripts": {
|
||||
"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 && webpack --color --config terminus-ssh/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",
|
||||
"start": "cross-env DEV=1 electron app --debug",
|
||||
"prod": "cross-env DEV=1 electron app",
|
||||
"lint": "tslint -c tslint.json -t stylish terminus-*/src/**/*.ts terminus-*/src/*.ts app/src/*.ts",
|
||||
"postinstall": "install-app-deps"
|
||||
},
|
||||
|
@@ -3,5 +3,13 @@ const rebuild = require('electron-rebuild').default
|
||||
const path = require('path')
|
||||
const vars = require('./vars')
|
||||
|
||||
rebuild(path.resolve(__dirname, '../terminus-ssh'), vars.electronVersion, process.arch, [], true)
|
||||
rebuild(path.resolve(__dirname, '../terminus-terminal'), vars.electronVersion, process.arch, [], true)
|
||||
rebuild({
|
||||
buildPath: path.resolve(__dirname, '../terminus-ssh'),
|
||||
electronVersion: vars.electronVersion,
|
||||
force: true,
|
||||
})
|
||||
rebuild({
|
||||
buildPath: path.resolve(__dirname, '../terminus-terminal'),
|
||||
electronVersion: vars.electronVersion,
|
||||
force: true,
|
||||
})
|
||||
|
@@ -20,3 +20,14 @@ vars.builtinPlugins.forEach(plugin => {
|
||||
sh.exec(`${npx} yarn install`)
|
||||
sh.cd('..')
|
||||
})
|
||||
|
||||
if (['darwin', 'linux'].includes(process.platform)) {
|
||||
sh.cd('node_modules')
|
||||
for (let x of vars.builtinPlugins) {
|
||||
sh.ln('-fs', '../' + x, x)
|
||||
}
|
||||
for (let x of vars.bundledModules) {
|
||||
sh.ln('-fs', '../app/node_modules/' + x, x)
|
||||
}
|
||||
sh.cd('..')
|
||||
}
|
||||
|
@@ -16,5 +16,9 @@ exports.builtinPlugins = [
|
||||
'terminus-plugin-manager',
|
||||
'terminus-ssh',
|
||||
]
|
||||
exports.bundledModules = [
|
||||
'@angular',
|
||||
'@ng-bootstrap',
|
||||
]
|
||||
exports.nativeModules = ['node-pty-tmp', 'font-manager', 'xkeychain']
|
||||
exports.electronVersion = pkgInfo.devDependencies.electron
|
||||
|
36
terminus-community-color-schemes/schemes/Tango
Normal file
36
terminus-community-color-schemes/schemes/Tango
Normal file
@@ -0,0 +1,36 @@
|
||||
! special
|
||||
*.foreground: #babdb6
|
||||
*.background: #000000
|
||||
*.cursorColor: #babdb6
|
||||
|
||||
! black
|
||||
*.color0: #2e3436
|
||||
*.color8: #555753
|
||||
|
||||
! red
|
||||
*.color1: #cc0000
|
||||
*.color9: #ef2929
|
||||
|
||||
! green
|
||||
*.color2: #4e9a06
|
||||
*.color10: #8ae234
|
||||
|
||||
! yellow
|
||||
*.color3: #c4a000
|
||||
*.color11: #fce94f
|
||||
|
||||
! blue
|
||||
*.color4: #3465a4
|
||||
*.color12: #729fcf
|
||||
|
||||
! magenta
|
||||
*.color5: #75507b
|
||||
*.color13: #ad7fa8
|
||||
|
||||
! cyan
|
||||
*.color6: #06989a
|
||||
*.color14: #34e2e2
|
||||
|
||||
! white
|
||||
*.color7: #d3d7cf
|
||||
*.color15: #eeeeec
|
@@ -18,20 +18,22 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ test: /[\\\/]schemes[\\\/]/, loader: "raw-loader" },
|
||||
{ test: /[\\\/]schemes[\\\/]/, use: "raw-loader" },
|
||||
]
|
||||
},
|
||||
externals: [
|
||||
|
@@ -25,8 +25,7 @@
|
||||
"bootstrap": "4.0.0-alpha.6",
|
||||
"core-js": "^2.4.1",
|
||||
"electron-updater": "^2.8.9",
|
||||
"ngx-perfect-scrollbar": "4.0.0",
|
||||
"typescript": "^2.4.1"
|
||||
"ngx-perfect-scrollbar": "^6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/animations": "4.0.1",
|
||||
|
@@ -1,6 +1,7 @@
|
||||
export interface IToolbarButton {
|
||||
icon: string
|
||||
title: string
|
||||
touchBarTitle?: string
|
||||
weight?: number
|
||||
click: () => void
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
title-bar(
|
||||
*ngIf='!hostApp.getWindow().isFullScreen() && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"',
|
||||
*ngIf='!hostApp.isFullScreen && config.store.appearance.frame == "full" && config.store.appearance.dock == "off"',
|
||||
[class.inset]='hostApp.platform == Platform.macOS'
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ title-bar(
|
||||
[class.tabs-on-top]='config.store.appearance.tabsLocation == "top"'
|
||||
)
|
||||
.tab-bar(
|
||||
*ngIf='!hostApp.getWindow().isFullScreen()',
|
||||
*ngIf='!hostApp.isFullScreen',
|
||||
[class.inset]='hostApp.platform == Platform.macOS && config.store.appearance.frame == "thin" && config.store.appearance.tabsLocation == "top"'
|
||||
)
|
||||
.tabs
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Inject, Input, HostListener } from '@angular/core'
|
||||
import { Component, Inject, Input, HostListener, HostBinding } from '@angular/core'
|
||||
import { trigger, style, animate, transition, state } from '@angular/animations'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
@@ -11,6 +11,7 @@ import { DockingService } from '../services/docking.service'
|
||||
import { TabRecoveryService } from '../services/tabRecovery.service'
|
||||
import { ThemesService } from '../services/themes.service'
|
||||
import { UpdaterService, Update } from '../services/updater.service'
|
||||
import { TouchbarService } from '../services/touchbar.service'
|
||||
|
||||
import { SafeModeModalComponent } from './safeModeModal.component'
|
||||
import { AppService, IToolbarButton, ToolbarButtonProvider } from '../api'
|
||||
@@ -53,6 +54,7 @@ export class AppRootComponent {
|
||||
@Input() ready = false
|
||||
@Input() leftToolbarButtons: IToolbarButton[]
|
||||
@Input() rightToolbarButtons: IToolbarButton[]
|
||||
@HostBinding('class') hostClass = `platform-${process.platform}`
|
||||
private logger: Logger
|
||||
private appUpdate: Update
|
||||
|
||||
@@ -62,6 +64,7 @@ export class AppRootComponent {
|
||||
private tabRecovery: TabRecoveryService,
|
||||
private hotkeys: HotkeysService,
|
||||
private updater: UpdaterService,
|
||||
private touchbar: TouchbarService,
|
||||
public hostApp: HostAppService,
|
||||
public config: ConfigService,
|
||||
public app: AppService,
|
||||
@@ -121,16 +124,22 @@ export class AppRootComponent {
|
||||
this.updater.check().then(update => {
|
||||
this.appUpdate = update
|
||||
})
|
||||
|
||||
this.touchbar.update()
|
||||
}
|
||||
|
||||
onGlobalHotkey () {
|
||||
if (this.electron.app.window.isFocused()) {
|
||||
// focused
|
||||
this.electron.app.window.hide()
|
||||
this.electron.loseFocus()
|
||||
if (this.hostApp.platform !== Platform.macOS) {
|
||||
this.electron.app.window.hide()
|
||||
}
|
||||
} else {
|
||||
if (!this.electron.app.window.isVisible()) {
|
||||
// unfocused, invisible
|
||||
this.electron.app.window.show()
|
||||
this.electron.app.window.focus()
|
||||
} else {
|
||||
if (this.config.store.appearance.dock === 'off') {
|
||||
// not docked, visible
|
||||
|
@@ -5,6 +5,7 @@ export abstract class BaseTabComponent {
|
||||
private static lastTabID = 0
|
||||
id: number
|
||||
title: string
|
||||
titleChange$ = new Subject<string>()
|
||||
customTitle: string
|
||||
scrollable: boolean
|
||||
hasActivity = false
|
||||
@@ -23,6 +24,13 @@ export abstract class BaseTabComponent {
|
||||
})
|
||||
}
|
||||
|
||||
setTitle (title: string) {
|
||||
this.title = title
|
||||
if (!this.customTitle) {
|
||||
this.titleChange$.next(title)
|
||||
}
|
||||
}
|
||||
|
||||
displayActivity (): void {
|
||||
this.hasActivity = true
|
||||
}
|
||||
|
4
terminus-core/src/components/checkbox.component.pug
Normal file
4
terminus-core/src/components/checkbox.component.pug
Normal file
@@ -0,0 +1,4 @@
|
||||
.icon((click)='click()', tabindex='0', [class.active]='model', (keyup.space)='click()')
|
||||
i.fa.fa-square-o.off
|
||||
i.fa.fa-check-square.on
|
||||
.text((click)='click()') {{text}}
|
51
terminus-core/src/components/checkbox.component.scss
Normal file
51
terminus-core/src/components/checkbox.component.scss
Normal file
@@ -0,0 +1,51 @@
|
||||
:host {
|
||||
cursor: pointer;
|
||||
margin: 5px 0;
|
||||
|
||||
&:focus {
|
||||
background: rgba(255,255,255,.05);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: rgba(255,255,255,.1);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
position: relative;
|
||||
flex: none;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
|
||||
i {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -2px;
|
||||
transition: 0.25s opacity;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
i.on, &.active i.off {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
i.off, &.active i.on {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.text {
|
||||
flex: auto;
|
||||
margin-left: 8px;
|
||||
}
|
||||
}
|
45
terminus-core/src/components/checkbox.component.ts
Normal file
45
terminus-core/src/components/checkbox.component.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { NgZone, Component, Input } from '@angular/core'
|
||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
|
||||
@Component({
|
||||
selector: 'checkbox',
|
||||
template: require('./checkbox.component.pug'),
|
||||
styles: [require('./checkbox.component.scss')],
|
||||
providers: [
|
||||
{ provide: NG_VALUE_ACCESSOR, useExisting: CheckboxComponent, multi: true },
|
||||
]
|
||||
})
|
||||
export class CheckboxComponent implements ControlValueAccessor {
|
||||
@Input() model: boolean
|
||||
@Input() disabled: boolean
|
||||
@Input() text: string
|
||||
private changed = new Array<(val: boolean) => void>()
|
||||
|
||||
click () {
|
||||
NgZone.assertInAngularZone()
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
|
||||
this.model = !this.model
|
||||
for (let fx of this.changed) {
|
||||
fx(this.model)
|
||||
}
|
||||
}
|
||||
|
||||
writeValue (obj: any) {
|
||||
this.model = obj
|
||||
}
|
||||
|
||||
registerOnChange (fn: any): void {
|
||||
this.changed.push(fn)
|
||||
}
|
||||
|
||||
registerOnTouched (fn: any): void {
|
||||
this.changed.push(fn)
|
||||
}
|
||||
|
||||
setDisabledState (isDisabled: boolean) {
|
||||
this.disabled = isDisabled
|
||||
}
|
||||
}
|
@@ -15,4 +15,9 @@
|
||||
flex: auto;
|
||||
}
|
||||
}
|
||||
|
||||
> perfect-scrollbar {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import { BaseTabComponent } from '../components/baseTab.component'
|
||||
<perfect-scrollbar [config]="{ suppressScrollX: true }" *ngIf="scrollable">
|
||||
<ng-template #scrollablePlaceholder></ng-template>
|
||||
</perfect-scrollbar>
|
||||
<template #nonScrollablePlaceholder [ngIf]="!scrollable"></template>
|
||||
<ng-template #nonScrollablePlaceholder *ngIf="!scrollable"></ng-template>
|
||||
`,
|
||||
styles: [
|
||||
require('./tabBody.component.scss'),
|
||||
|
@@ -14,8 +14,6 @@ $tabs-height: 36px;
|
||||
|
||||
transition: 0.125s ease-out all;
|
||||
|
||||
border-top: 1px solid transparent;
|
||||
|
||||
.index {
|
||||
flex: none;
|
||||
font-weight: bold;
|
||||
|
@@ -69,6 +69,7 @@ export class TabHeaderComponent {
|
||||
let modal = this.ngbModal.open(RenameTabModalComponent)
|
||||
modal.componentInstance.value = this.tab.customTitle || this.tab.title
|
||||
modal.result.then(result => {
|
||||
this.tab.setTitle(result)
|
||||
this.tab.customTitle = result
|
||||
}).catch(() => null)
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ import { BrowserModule } from '@angular/platform-browser'
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'
|
||||
import { PerfectScrollbarModule, PERFECT_SCROLLBAR_CONFIG } from 'ngx-perfect-scrollbar'
|
||||
|
||||
import { AppService } from './services/app.service'
|
||||
import { ConfigService } from './services/config.service'
|
||||
@@ -14,9 +14,11 @@ import { HotkeysService, AppHotkeyProvider } from './services/hotkeys.service'
|
||||
import { DockingService } from './services/docking.service'
|
||||
import { TabRecoveryService } from './services/tabRecovery.service'
|
||||
import { ThemesService } from './services/themes.service'
|
||||
import { TouchbarService } from './services/touchbar.service'
|
||||
import { UpdaterService } from './services/updater.service'
|
||||
|
||||
import { AppRootComponent } from './components/appRoot.component'
|
||||
import { CheckboxComponent } from './components/checkbox.component'
|
||||
import { TabBodyComponent } from './components/tabBody.component'
|
||||
import { SafeModeModalComponent } from './components/safeModeModal.component'
|
||||
import { StartPageComponent } from './components/startPage.component'
|
||||
@@ -32,7 +34,7 @@ import { Theme } from './api/theme'
|
||||
import { StandardTheme, StandardCompactTheme } from './theme'
|
||||
import { CoreConfigProvider } from './config'
|
||||
|
||||
import 'perfect-scrollbar/dist/css/perfect-scrollbar.css'
|
||||
import 'perfect-scrollbar/css/perfect-scrollbar.css'
|
||||
|
||||
const PROVIDERS = [
|
||||
AppService,
|
||||
@@ -44,11 +46,13 @@ const PROVIDERS = [
|
||||
LogService,
|
||||
TabRecoveryService,
|
||||
ThemesService,
|
||||
TouchbarService,
|
||||
UpdaterService,
|
||||
{ provide: HotkeyProvider, useClass: AppHotkeyProvider, multi: true },
|
||||
{ provide: Theme, useClass: StandardTheme, multi: true },
|
||||
{ provide: Theme, useClass: StandardCompactTheme, multi: true },
|
||||
{ provide: ConfigProvider, useClass: CoreConfigProvider, multi: true },
|
||||
{ provide: PERFECT_SCROLLBAR_CONFIG, useValue: { suppressScrollX: true }}
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
@@ -57,12 +61,11 @@ const PROVIDERS = [
|
||||
BrowserAnimationsModule,
|
||||
FormsModule,
|
||||
NgbModule.forRoot(),
|
||||
PerfectScrollbarModule.forRoot({
|
||||
suppressScrollX: true,
|
||||
}),
|
||||
PerfectScrollbarModule,
|
||||
],
|
||||
declarations: [
|
||||
AppRootComponent,
|
||||
CheckboxComponent,
|
||||
StartPageComponent,
|
||||
TabBodyComponent,
|
||||
TabHeaderComponent,
|
||||
@@ -74,6 +77,9 @@ const PROVIDERS = [
|
||||
entryComponents: [
|
||||
RenameTabModalComponent,
|
||||
SafeModeModalComponent,
|
||||
],
|
||||
exports: [
|
||||
CheckboxComponent
|
||||
]
|
||||
})
|
||||
export default class AppModule {
|
||||
@@ -85,5 +91,11 @@ export default class AppModule {
|
||||
}
|
||||
}
|
||||
|
||||
// PerfectScrollbar fix
|
||||
import { fromEvent } from 'rxjs/internal/observable/fromEvent'
|
||||
import { merge } from 'rxjs/internal/observable/merge'
|
||||
require('rxjs').fromEvent = fromEvent
|
||||
require('rxjs').merge = merge
|
||||
|
||||
export { AppRootComponent as bootstrap }
|
||||
export * from './api'
|
||||
|
@@ -2,8 +2,8 @@ import { Subject, AsyncSubject } from 'rxjs'
|
||||
import { Injectable, ComponentFactoryResolver, Injector, Optional } from '@angular/core'
|
||||
import { DefaultTabProvider } from '../api/defaultTabProvider'
|
||||
import { BaseTabComponent } from '../components/baseTab.component'
|
||||
import { Logger, LogService } from '../services/log.service'
|
||||
import { ConfigService } from '../services/config.service'
|
||||
import { Logger, LogService } from './log.service'
|
||||
import { ConfigService } from './config.service'
|
||||
|
||||
export declare type TabComponentType = new (...args: any[]) => BaseTabComponent
|
||||
|
||||
@@ -11,9 +11,12 @@ export declare type TabComponentType = new (...args: any[]) => BaseTabComponent
|
||||
export class AppService {
|
||||
tabs: BaseTabComponent[] = []
|
||||
activeTab: BaseTabComponent
|
||||
activeTabChange$ = new Subject<BaseTabComponent>()
|
||||
lastTabIndex = 0
|
||||
logger: Logger
|
||||
tabsChanged$ = new Subject<void>()
|
||||
tabOpened$ = new Subject<BaseTabComponent>()
|
||||
tabClosed$ = new Subject<BaseTabComponent>()
|
||||
ready$ = new AsyncSubject<void>()
|
||||
|
||||
constructor (
|
||||
@@ -35,6 +38,7 @@ export class AppService {
|
||||
this.tabs.push(componentRef.instance)
|
||||
this.selectTab(componentRef.instance)
|
||||
this.tabsChanged$.next()
|
||||
this.tabOpened$.next(componentRef.instance)
|
||||
|
||||
return componentRef.instance
|
||||
}
|
||||
@@ -59,6 +63,7 @@ export class AppService {
|
||||
this.activeTab.blurred$.next()
|
||||
}
|
||||
this.activeTab = tab
|
||||
this.activeTabChange$.next(tab)
|
||||
if (this.activeTab) {
|
||||
this.activeTab.focused$.next()
|
||||
}
|
||||
@@ -107,6 +112,7 @@ export class AppService {
|
||||
this.selectTab(this.tabs[newIndex])
|
||||
}
|
||||
this.tabsChanged$.next()
|
||||
this.tabClosed$.next(tab)
|
||||
}
|
||||
|
||||
emitReady () {
|
||||
|
@@ -6,7 +6,6 @@ import { Injectable, Inject } from '@angular/core'
|
||||
import { ConfigProvider } from '../api/configProvider'
|
||||
import { ElectronService } from './electron.service'
|
||||
import { HostAppService } from './hostApp.service'
|
||||
import * as Reflect from 'core-js/es7/reflect'
|
||||
|
||||
const configMerge = (a, b) => require('deepmerge')(a, b, { arrayMerge: (_d, s) => s })
|
||||
|
||||
@@ -104,12 +103,11 @@ export class ConfigService {
|
||||
enabledServices<T> (services: T[]): T[] {
|
||||
if (!this.servicesCache) {
|
||||
this.servicesCache = {}
|
||||
let ngModule = Reflect.getMetadata('annotations', window['rootModule'])[0]
|
||||
let ngModule = window['rootModule'].ngInjectorDef
|
||||
for (let imp of ngModule.imports) {
|
||||
let module = imp['module'] || imp
|
||||
let annotations = Reflect.getMetadata('annotations', module)
|
||||
if (annotations) {
|
||||
this.servicesCache[module['pluginName']] = annotations[0].providers.map(provider => {
|
||||
let module = (imp['ngModule'] || imp)
|
||||
if (module.ngInjectorDef && module.ngInjectorDef.providers) {
|
||||
this.servicesCache[module['pluginName']] = module.ngInjectorDef.providers.map(provider => {
|
||||
return provider['useClass'] || provider
|
||||
})
|
||||
}
|
||||
|
@@ -29,18 +29,19 @@ export class DockingService {
|
||||
let dockSide = this.config.store.appearance.dock
|
||||
let newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
|
||||
let fill = this.config.store.appearance.dockFill
|
||||
let [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
|
||||
|
||||
if (dockSide === 'off') {
|
||||
this.hostApp.setAlwaysOnTop(false)
|
||||
return
|
||||
}
|
||||
if (dockSide === 'left' || dockSide === 'right') {
|
||||
newBounds.width = Math.round(fill * display.bounds.width)
|
||||
newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
|
||||
newBounds.height = display.bounds.height
|
||||
}
|
||||
if (dockSide === 'top' || dockSide === 'bottom') {
|
||||
newBounds.width = display.bounds.width
|
||||
newBounds.height = Math.round(fill * display.bounds.height)
|
||||
newBounds.height = Math.max(minHeight, Math.round(fill * display.bounds.height))
|
||||
}
|
||||
if (dockSide === 'right') {
|
||||
newBounds.x = display.bounds.x + display.bounds.width - newBounds.width
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { TouchBar } from 'electron'
|
||||
|
||||
@Injectable()
|
||||
export class ElectronService {
|
||||
@@ -10,6 +11,7 @@ export class ElectronService {
|
||||
globalShortcut: any
|
||||
screen: any
|
||||
remote: any
|
||||
TouchBar: typeof TouchBar
|
||||
private electron: any
|
||||
|
||||
constructor () {
|
||||
@@ -22,6 +24,7 @@ export class ElectronService {
|
||||
this.clipboard = this.electron.clipboard
|
||||
this.ipcRenderer = this.electron.ipcRenderer
|
||||
this.globalShortcut = this.remote.globalShortcut
|
||||
this.TouchBar = this.remote.TouchBar
|
||||
}
|
||||
|
||||
remoteRequire (name: string): any {
|
||||
@@ -29,6 +32,16 @@ export class ElectronService {
|
||||
}
|
||||
|
||||
remoteRequirePluginModule (plugin: string, module: string, globals: any): any {
|
||||
return this.remoteRequire(globals.require.resolve(`${plugin}/node_modules/${module}`))
|
||||
return this.remoteRequire(this.remoteResolvePluginModule(plugin, module, globals))
|
||||
}
|
||||
|
||||
remoteResolvePluginModule (plugin: string, module: string, globals: any): any {
|
||||
return globals.require.resolve(`${plugin}/node_modules/${module}`)
|
||||
}
|
||||
|
||||
loseFocus () {
|
||||
if (process.platform === 'darwin') {
|
||||
this.remote.Menu.sendActionToFirstResponder('hide:')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ export class HostAppService {
|
||||
ready = new EventEmitter<any>()
|
||||
shown = new EventEmitter<any>()
|
||||
secondInstance$ = new Subject<{ argv: string[], cwd: string }>()
|
||||
|
||||
isFullScreen = false
|
||||
private logger: Logger
|
||||
|
||||
constructor (
|
||||
@@ -44,6 +44,14 @@ export class HostAppService {
|
||||
this.logger.error('Unhandled exception:', err)
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on('host:window-enter-full-screen', () => this.zone.run(() => {
|
||||
this.isFullScreen = true
|
||||
}))
|
||||
|
||||
electron.ipcRenderer.on('host:window-leave-full-screen', () => this.zone.run(() => {
|
||||
this.isFullScreen = false
|
||||
}))
|
||||
|
||||
electron.ipcRenderer.on('host:window-shown', () => {
|
||||
this.zone.run(() => this.shown.emit())
|
||||
})
|
||||
@@ -86,10 +94,6 @@ export class HostAppService {
|
||||
this.electron.ipcRenderer.send('window-focus')
|
||||
}
|
||||
|
||||
toggleWindow () {
|
||||
this.electron.ipcRenderer.send('window-toggle-focus')
|
||||
}
|
||||
|
||||
minimize () {
|
||||
this.electron.ipcRenderer.send('window-minimize')
|
||||
}
|
||||
|
76
terminus-core/src/services/touchbar.service.ts
Normal file
76
terminus-core/src/services/touchbar.service.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { Injectable, Inject, NgZone } from '@angular/core'
|
||||
import { TouchBarSegmentedControl, SegmentedControlSegment } from 'electron'
|
||||
import { Subject, Subscription } from 'rxjs'
|
||||
import { AppService } from './app.service'
|
||||
import { ConfigService } from './config.service'
|
||||
import { ElectronService } from './electron.service'
|
||||
import { BaseTabComponent } from '../components/baseTab.component'
|
||||
import { IToolbarButton, ToolbarButtonProvider } from '../api'
|
||||
|
||||
@Injectable()
|
||||
export class TouchbarService {
|
||||
tabSelected$ = new Subject<number>()
|
||||
private titleSubscriptions = new Map<BaseTabComponent, Subscription>()
|
||||
private tabsSegmentedControl: TouchBarSegmentedControl
|
||||
private tabSegments: SegmentedControlSegment[] = []
|
||||
|
||||
constructor (
|
||||
private app: AppService,
|
||||
@Inject(ToolbarButtonProvider) private toolbarButtonProviders: ToolbarButtonProvider[],
|
||||
private config: ConfigService,
|
||||
private electron: ElectronService,
|
||||
private zone: NgZone,
|
||||
) {
|
||||
app.tabsChanged$.subscribe(() => this.update())
|
||||
app.activeTabChange$.subscribe(() => this.update())
|
||||
app.tabOpened$.subscribe(tab => {
|
||||
let sub = tab.titleChange$.subscribe(title => {
|
||||
this.tabSegments[app.tabs.indexOf(tab)].label = this.shortenTitle(title)
|
||||
this.tabsSegmentedControl.segments = this.tabSegments
|
||||
})
|
||||
this.titleSubscriptions.set(tab, sub)
|
||||
})
|
||||
app.tabClosed$.subscribe(tab => {
|
||||
this.titleSubscriptions.get(tab).unsubscribe()
|
||||
this.titleSubscriptions.delete(tab)
|
||||
})
|
||||
}
|
||||
|
||||
update () {
|
||||
let buttons: IToolbarButton[] = []
|
||||
this.config.enabledServices(this.toolbarButtonProviders).forEach(provider => {
|
||||
buttons = buttons.concat(provider.provide())
|
||||
})
|
||||
buttons.sort((a, b) => (a.weight || 0) - (b.weight || 0))
|
||||
this.tabSegments = this.app.tabs.map(tab => ({
|
||||
label: this.shortenTitle(tab.title),
|
||||
}))
|
||||
this.tabsSegmentedControl = new this.electron.TouchBar.TouchBarSegmentedControl({
|
||||
segments: this.tabSegments,
|
||||
selectedIndex: this.app.tabs.indexOf(this.app.activeTab),
|
||||
change: (selectedIndex) => this.zone.run(() => {
|
||||
this.app.selectTab(this.app.tabs[selectedIndex])
|
||||
})
|
||||
})
|
||||
let touchBar = new this.electron.TouchBar({
|
||||
items: [
|
||||
this.tabsSegmentedControl,
|
||||
new this.electron.TouchBar.TouchBarSpacer({size: 'flexible'}),
|
||||
new this.electron.TouchBar.TouchBarSpacer({size: 'small'}),
|
||||
...buttons.map(button => new this.electron.TouchBar.TouchBarButton({
|
||||
label: this.shortenTitle(button.touchBarTitle || button.title),
|
||||
// backgroundColor: '#0022cc',
|
||||
click: () => this.zone.run(() => button.click()),
|
||||
}))
|
||||
]
|
||||
})
|
||||
this.electron.app.window.setTouchBar(touchBar)
|
||||
}
|
||||
|
||||
private shortenTitle (title: string): string {
|
||||
if (title.length > 15) {
|
||||
title = title.substring(0, 15) + '...'
|
||||
}
|
||||
return title
|
||||
}
|
||||
}
|
@@ -47,6 +47,7 @@ $input-color-placeholder: #333;
|
||||
$input-border-color: #344;
|
||||
//$input-box-shadow: inset 0 1px 1px rgba($black,.075);
|
||||
$input-border-radius: 0;
|
||||
$custom-select-border-radius: 0;
|
||||
$input-bg-focus: $input-bg;
|
||||
//$input-border-focus: lighten($brand-primary, 25%);
|
||||
//$input-box-shadow-focus: $input-box-shadow, rgba($input-border-focus, .6);
|
||||
@@ -83,6 +84,8 @@ $alert-danger-bg: $body-bg2;
|
||||
$alert-danger-text: $red;
|
||||
$alert-danger-border: $red;
|
||||
|
||||
$headings-font-weight: lighter;
|
||||
$headings-color: #eee;
|
||||
|
||||
@import '~bootstrap/scss/bootstrap.scss';
|
||||
|
||||
@@ -105,7 +108,7 @@ window-controls {
|
||||
}
|
||||
}
|
||||
|
||||
$border-color: #141414;
|
||||
$border-color: #111;
|
||||
|
||||
app-root {
|
||||
&> .content {
|
||||
@@ -131,7 +134,8 @@ app-root {
|
||||
background: $body-bg2;
|
||||
border-left: 1px solid transparent;
|
||||
border-right: 1px solid transparent;
|
||||
border-top: 1px solid transparent;
|
||||
|
||||
transition: 0.25s all;
|
||||
|
||||
.index {
|
||||
color: #555;
|
||||
@@ -147,6 +151,7 @@ app-root {
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: white;
|
||||
background: $body-bg;
|
||||
border-left: 1px solid $border-color;
|
||||
border-right: 1px solid $border-color;
|
||||
@@ -159,17 +164,15 @@ app-root {
|
||||
border-bottom: 1px solid $border-color;
|
||||
|
||||
tab-header {
|
||||
border-top: 1px solid transparent;
|
||||
border-bottom: 1px solid $border-color;
|
||||
margin-bottom: -1px;
|
||||
|
||||
&.active {
|
||||
border-top: 1px solid $teal;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
&.has-activity:not(.active) {
|
||||
border-top: 1px solid $green;
|
||||
background: linear-gradient(to bottom, rgba(208, 0, 0, 0) 95%, #1aa99c 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,21 +181,26 @@ app-root {
|
||||
border-top: 1px solid $border-color;
|
||||
|
||||
tab-header {
|
||||
border-bottom: 1px solid transparent;
|
||||
border-top: 1px solid $border-color;
|
||||
margin-top: -1px;
|
||||
|
||||
&.active {
|
||||
border-bottom: 1px solid $teal;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
&.has-activity:not(.active) {
|
||||
border-bottom: 1px solid $green;
|
||||
background: linear-gradient(to top, rgba(208, 0, 0, 0) 95%, #1aa99c 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.platform-win32, &.platform-linux {
|
||||
border: 1px solid #111;
|
||||
&>.content .tab-bar .tabs tab-header:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tab-body {
|
||||
@@ -332,3 +340,15 @@ ngb-tabset .tab-content {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
select.form-control {
|
||||
-webkit-appearance: none;
|
||||
background-image: url("data:image/svg+xml;utf8,<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24' height='24' viewBox='0 0 24 24'><path fill='#444' d='M7.406 7.828l4.594 4.594 4.594-4.594 1.406 1.406-6 6-6-6z'></path></svg>");
|
||||
background-position: 100% 50%;
|
||||
background-repeat: no-repeat;
|
||||
padding-right: 30px;
|
||||
}
|
||||
|
||||
checkbox i.on {
|
||||
color: $blue;
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ module.exports = {
|
||||
entry: 'src/index.ts',
|
||||
devtool: 'source-map',
|
||||
context: __dirname,
|
||||
mode: 'development',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'index.js',
|
||||
@@ -18,16 +19,18 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -185,15 +185,20 @@ ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
|
||||
ngx-perfect-scrollbar@4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ngx-perfect-scrollbar/-/ngx-perfect-scrollbar-4.0.0.tgz#f1e19449fa97d7f16e1ceb1fe1739e4bb646bebe"
|
||||
ngx-perfect-scrollbar@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ngx-perfect-scrollbar/-/ngx-perfect-scrollbar-6.0.0.tgz#92b51957c04ed6a6d416beca2707bab005667b68"
|
||||
dependencies:
|
||||
perfect-scrollbar "~0.6.0"
|
||||
perfect-scrollbar "^1.3.0"
|
||||
resize-observer-polyfill "^1.4.0"
|
||||
|
||||
perfect-scrollbar@~0.6.0:
|
||||
version "0.6.16"
|
||||
resolved "https://registry.yarnpkg.com/perfect-scrollbar/-/perfect-scrollbar-0.6.16.tgz#b1d61a5245cf3962bb9a8407a3fc669d923212fc"
|
||||
perfect-scrollbar@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/perfect-scrollbar/-/perfect-scrollbar-1.3.0.tgz#61da56f94b58870d8e0a617bce649cee17d1e3b2"
|
||||
|
||||
resize-observer-polyfill@^1.4.0:
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.0.tgz#660ff1d9712a2382baa2cad450a4716209f9ca69"
|
||||
|
||||
sax@^1.2.1:
|
||||
version "1.2.4"
|
||||
@@ -225,10 +230,6 @@ tether@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/tether/-/tether-1.4.0.tgz#0f9fa171f75bf58485d8149e94799d7ae74d1c1a"
|
||||
|
||||
typescript@^2.4.1:
|
||||
version "2.5.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.2.tgz#038a95f7d9bbb420b1bf35ba31d4c5c1dd3ffe34"
|
||||
|
||||
universalify@^0.1.0:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.1.tgz#fa71badd4437af4c148841e3b3b165f9e9e590b7"
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { BehaviorSubject, Observable } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, first, tap, flatMap } from 'rxjs/operators'
|
||||
import * as semver from 'semver'
|
||||
|
||||
import { Component, Input } from '@angular/core'
|
||||
@@ -33,15 +34,18 @@ export class PluginsSettingsTabComponent {
|
||||
|
||||
ngOnInit () {
|
||||
this.availablePlugins$ = this.availablePluginsQuery$
|
||||
.debounceTime(200)
|
||||
.distinctUntilChanged()
|
||||
.flatMap(query => {
|
||||
this.availablePluginsReady = false
|
||||
return this.pluginManager.listAvailable(query).do(() => {
|
||||
this.availablePluginsReady = true
|
||||
.asObservable()
|
||||
.pipe(
|
||||
debounceTime(200),
|
||||
distinctUntilChanged(),
|
||||
flatMap(query => {
|
||||
this.availablePluginsReady = false
|
||||
return this.pluginManager.listAvailable(query).pipe(tap(() => {
|
||||
this.availablePluginsReady = true
|
||||
}))
|
||||
})
|
||||
})
|
||||
this.availablePlugins$.first().subscribe(available => {
|
||||
)
|
||||
this.availablePlugins$.pipe(first()).subscribe(available => {
|
||||
for (let plugin of this.pluginManager.installedPlugins) {
|
||||
this.knownUpgrades[plugin.name] = available.find(x => x.name === plugin.name && semver.gt(x.version, plugin.version))
|
||||
}
|
||||
|
@@ -2,7 +2,8 @@ import * as path from 'path'
|
||||
import * as fs from 'mz/fs'
|
||||
import { exec } from 'mz/child_process'
|
||||
import axios from 'axios'
|
||||
import { Observable } from 'rxjs'
|
||||
import { Observable, from } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Logger, LogService, ConfigService, HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
@@ -29,6 +30,7 @@ export class PluginManagerService {
|
||||
userPluginsPath: string = (window as any).userPluginsPath
|
||||
installedPlugins: IPluginInfo[] = (window as any).installedPlugins
|
||||
npmPath: string
|
||||
private envPath: string
|
||||
|
||||
constructor (
|
||||
log: LogService,
|
||||
@@ -41,11 +43,13 @@ export class PluginManagerService {
|
||||
|
||||
async detectPath () {
|
||||
this.npmPath = this.config.store.npm
|
||||
this.envPath = process.env.PATH
|
||||
if (await fs.exists(this.npmPath)) {
|
||||
return
|
||||
}
|
||||
if (this.hostApp.platform !== Platform.Windows) {
|
||||
let searchPaths = (await exec('$SHELL -c -i \'echo $PATH\''))[0].toString().trim().split(':')
|
||||
this.envPath = (await exec('$SHELL -c -i \'echo $PATH\''))[0].toString().trim()
|
||||
let searchPaths = this.envPath.split(':')
|
||||
for (let searchPath of searchPaths) {
|
||||
if (await fs.exists(path.join(searchPath, 'npm'))) {
|
||||
this.logger.debug('Found npm in', searchPath)
|
||||
@@ -59,7 +63,7 @@ export class PluginManagerService {
|
||||
async isNPMInstalled (): Promise<boolean> {
|
||||
await this.detectPath()
|
||||
try {
|
||||
await exec(`${this.npmPath} -v`)
|
||||
await exec(`${this.npmPath} -v`, { env: this.getEnv() })
|
||||
return true
|
||||
} catch (_) {
|
||||
return false
|
||||
@@ -67,11 +71,10 @@ export class PluginManagerService {
|
||||
}
|
||||
|
||||
listAvailable (query?: string): Observable<IPluginInfo[]> {
|
||||
return Observable
|
||||
.fromPromise(
|
||||
axios.get(`https://www.npmjs.com/-/search?text=keywords:${KEYWORD}+${encodeURIComponent(query || '')}&from=0&size=1000`)
|
||||
)
|
||||
.map(response => response.data.objects.map(item => ({
|
||||
return from(
|
||||
axios.get(`https://api.npms.io/v2/search?q=keywords%3A${KEYWORD}+${encodeURIComponent(query || '')}&from=0&size=250`, {})
|
||||
).pipe(
|
||||
map(response => response.data.results.map(item => ({
|
||||
name: item.package.name.substring(NAME_PREFIX.length),
|
||||
packageName: item.package.name,
|
||||
description: item.package.description,
|
||||
@@ -79,18 +82,23 @@ export class PluginManagerService {
|
||||
homepage: item.package.links.homepage,
|
||||
author: (item.package.author || {}).name,
|
||||
isOfficial: item.package.publisher.username === OFFICIAL_NPM_ACCOUNT,
|
||||
})))
|
||||
.map(plugins => plugins.filter(x => x.packageName.startsWith(NAME_PREFIX)))
|
||||
}))),
|
||||
map(plugins => plugins.filter(x => x.packageName.startsWith(NAME_PREFIX))),
|
||||
)
|
||||
}
|
||||
|
||||
async installPlugin (plugin: IPluginInfo) {
|
||||
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`)
|
||||
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" install ${plugin.packageName}@${plugin.version}`, { env: this.getEnv() })
|
||||
this.installedPlugins = this.installedPlugins.filter(x => x.packageName !== plugin.packageName)
|
||||
this.installedPlugins.push(plugin)
|
||||
}
|
||||
|
||||
async uninstallPlugin (plugin: IPluginInfo) {
|
||||
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" remove ${plugin.packageName}`)
|
||||
await exec(`${this.npmPath} --prefix "${this.userPluginsPath}" remove ${plugin.packageName}`, { env: this.getEnv() })
|
||||
this.installedPlugins = this.installedPlugins.filter(x => x.packageName !== plugin.packageName)
|
||||
}
|
||||
|
||||
private getEnv (): any {
|
||||
return Object.assign(process.env, { PATH: this.envPath })
|
||||
}
|
||||
}
|
||||
|
@@ -18,16 +18,18 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -17,6 +17,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
return [{
|
||||
icon: 'sliders',
|
||||
title: 'Settings',
|
||||
touchBarTitle: '⚙️',
|
||||
weight: 10,
|
||||
click: () => this.open(),
|
||||
}]
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Component, Input, trigger, transition, style, animate } from '@angular/core'
|
||||
import { Component, Input } from '@angular/core'
|
||||
import { trigger, transition, style, animate } from '@angular/animations'
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { HotkeysService } from 'terminus-core'
|
||||
|
@@ -1,5 +1,10 @@
|
||||
:host {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
&:hover .add {
|
||||
display: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
@@ -22,4 +27,5 @@
|
||||
|
||||
.add {
|
||||
flex: auto;
|
||||
display: none;
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ ngb-tabset.vertical(type='tabs', [activeId]='activeTab')
|
||||
ng-template(ngbTabTitle)
|
||||
| Application
|
||||
ng-template(ngbTabContent)
|
||||
h3.mb-3 Application
|
||||
.row
|
||||
.col.col-lg-6
|
||||
.form-group
|
||||
@@ -168,6 +169,7 @@ ngb-tabset.vertical(type='tabs', [activeId]='activeTab')
|
||||
ng-template(ngbTabTitle)
|
||||
| Hotkeys
|
||||
ng-template(ngbTabContent)
|
||||
h3.mb-3 Hotkeys
|
||||
input.form-control(type='search', placeholder='Search hotkeys', [(ngModel)]='hotkeyFilter')
|
||||
.form-group
|
||||
table.hotkeys-table
|
||||
|
@@ -14,8 +14,8 @@ import { SettingsTabProvider } from '../api'
|
||||
export class SettingsTabComponent extends BaseTabComponent {
|
||||
@Input() activeTab: string
|
||||
hotkeyFilter = ''
|
||||
private hotkeyDescriptions: IHotkeyDescription[]
|
||||
private screens
|
||||
hotkeyDescriptions: IHotkeyDescription[]
|
||||
screens: any[]
|
||||
|
||||
constructor (
|
||||
public config: ConfigService,
|
||||
@@ -28,7 +28,7 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
) {
|
||||
super()
|
||||
this.hotkeyDescriptions = config.enabledServices(hotkeyProviders).map(x => x.hotkeys).reduce((a, b) => a.concat(b))
|
||||
this.title = 'Settings'
|
||||
this.setTitle('Settings')
|
||||
this.scrollable = true
|
||||
this.screens = this.docking.getScreens()
|
||||
this.settingsProviders = config.enabledServices(this.settingsProviders)
|
||||
|
@@ -8,7 +8,7 @@ import { SettingsTabProvider } from '../api'
|
||||
export class SettingsTabBodyComponent {
|
||||
@Input() provider: SettingsTabProvider
|
||||
@ViewChild('placeholder', {read: ViewContainerRef}) placeholder: ViewContainerRef
|
||||
private component: ComponentRef<Component>
|
||||
component: ComponentRef<Component>
|
||||
|
||||
constructor (private componentFactoryResolver: ComponentFactoryResolver) { }
|
||||
|
||||
|
@@ -18,16 +18,18 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -19,12 +19,8 @@
|
||||
"devDependencies": {
|
||||
"@types/ssh2": "^0.5.35",
|
||||
"@types/webpack-env": "^1.13.0",
|
||||
"apply-loader": "^2.0.0",
|
||||
"awesome-typescript-loader": "^3.1.2",
|
||||
"electron": "^1.6.11",
|
||||
"ngx-toastr": "^8.0.0",
|
||||
"pug": "^2.0.0-rc.3",
|
||||
"pug-loader": "^2.3.0",
|
||||
"rxjs": "^5.4.0",
|
||||
"typescript": "^2.2.2",
|
||||
"webpack": "^2.3.3"
|
||||
|
@@ -18,10 +18,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
}
|
||||
|
||||
activate () {
|
||||
let modal = this.ngbModal.open(SSHModalComponent)
|
||||
modal.result.then(() => {
|
||||
//this.terminal.openTab(shell)
|
||||
})
|
||||
this.ngbModal.open(SSHModalComponent)
|
||||
}
|
||||
|
||||
provide (): IToolbarButton[] {
|
||||
@@ -29,6 +26,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
icon: 'globe',
|
||||
weight: 5,
|
||||
title: 'SSH connections',
|
||||
touchBarTitle: 'SSH',
|
||||
click: async () => {
|
||||
this.activate()
|
||||
}
|
||||
|
@@ -17,16 +17,18 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
options: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -39,7 +39,7 @@
|
||||
"dependencies": {
|
||||
"@types/async-lock": "0.0.19",
|
||||
"async-lock": "^1.0.0",
|
||||
"font-manager": "0.2.2",
|
||||
"font-manager": "0.3.0",
|
||||
"hterm-umdjs": "1.1.3",
|
||||
"mz": "^2.6.0",
|
||||
"node-pty-tmp": "0.7.1",
|
||||
|
@@ -1,24 +1,21 @@
|
||||
import * as fs from 'mz/fs'
|
||||
import * as path from 'path'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, ConfigService, HostAppService, ElectronService, Logger, LogService } from 'terminus-core'
|
||||
import { HotkeysService, ToolbarButtonProvider, IToolbarButton, ConfigService, HostAppService, ElectronService } from 'terminus-core'
|
||||
|
||||
import { TerminalService } from './services/terminal.service'
|
||||
|
||||
@Injectable()
|
||||
export class ButtonProvider extends ToolbarButtonProvider {
|
||||
private logger: Logger
|
||||
|
||||
constructor (
|
||||
private terminal: TerminalService,
|
||||
private config: ConfigService,
|
||||
log: LogService,
|
||||
hostApp: HostAppService,
|
||||
electron: ElectronService,
|
||||
hotkeys: HotkeysService,
|
||||
) {
|
||||
super()
|
||||
this.logger = log.create('newTerminalButton')
|
||||
hotkeys.matchedHotkey.subscribe(async (hotkey) => {
|
||||
if (hotkey === 'new-tab') {
|
||||
this.openNewTab()
|
||||
@@ -47,7 +44,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
}
|
||||
|
||||
async openNewTab (cwd?: string): Promise<void> {
|
||||
let shells = await this.terminal.shells$.first().toPromise()
|
||||
let shells = await this.terminal.shells$.pipe(first()).toPromise()
|
||||
let shell = shells.find(x => x.id === this.config.store.terminal.shell)
|
||||
this.terminal.openTab(shell, cwd)
|
||||
}
|
||||
@@ -56,6 +53,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
return [{
|
||||
icon: 'plus',
|
||||
title: 'New terminal',
|
||||
touchBarTitle: 'New',
|
||||
click: async () => {
|
||||
this.openNewTab()
|
||||
}
|
||||
|
@@ -1,5 +1,158 @@
|
||||
h3.mb-2 Appearance
|
||||
h3.mb-3 Appearance
|
||||
.row
|
||||
.col-md-6
|
||||
.form-group
|
||||
label Font
|
||||
.row
|
||||
.col-8
|
||||
input.form-control(
|
||||
type='text',
|
||||
[ngbTypeahead]='fontAutocomplete',
|
||||
[(ngModel)]='config.store.terminal.font',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
.col-4
|
||||
input.form-control(
|
||||
type='number',
|
||||
[(ngModel)]='config.store.terminal.fontSize',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
div
|
||||
checkbox(
|
||||
text='Enable font ligatures',
|
||||
[(ngModel)]='config.store.terminal.ligatures',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.form-group(*ngIf='!editingColorScheme')
|
||||
label Color scheme
|
||||
.input-group
|
||||
select.form-control(
|
||||
[compareWith]='equalComparator',
|
||||
[(ngModel)]='config.store.terminal.colorScheme',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option(*ngFor='let scheme of config.store.terminal.customColorSchemes', [ngValue]='scheme') Custom: {{scheme.name}}
|
||||
option(*ngFor='let scheme of colorSchemes', [ngValue]='scheme') {{scheme.name}}
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='editScheme(config.store.terminal.colorScheme)') Edit
|
||||
.input-group-btn
|
||||
button.btn.btn-outline-danger(
|
||||
(click)='deleteScheme(config.store.terminal.colorScheme)',
|
||||
*ngIf='isCustomScheme(config.store.terminal.colorScheme)'
|
||||
)
|
||||
i.fa.fa-trash-o
|
||||
|
||||
.form-group(*ngIf='editingColorScheme')
|
||||
label Editing
|
||||
.input-group
|
||||
input.form-control(type='text', [(ngModel)]='editingColorScheme.name')
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='saveScheme()') Save
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='cancelEditing()') Cancel
|
||||
|
||||
|
||||
.form-group(*ngIf='editingColorScheme')
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.foreground',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='FG',
|
||||
)
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.background',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='BG',
|
||||
)
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.cursor',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='CU',
|
||||
)
|
||||
color-picker(
|
||||
*ngFor='let _ of editingColorScheme.colors; let idx = index; trackBy: colorsTrackBy',
|
||||
'[(model)]'='editingColorScheme.colors[idx]',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
[title]='idx',
|
||||
)
|
||||
|
||||
.form-group
|
||||
label Terminal background
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.background',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"theme"'
|
||||
)
|
||||
| From theme
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"colorScheme"'
|
||||
)
|
||||
| From colors
|
||||
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Cursor shape
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.cursor',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"block"'
|
||||
)
|
||||
| █
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"beam"'
|
||||
)
|
||||
| |
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"underline"'
|
||||
)
|
||||
| ▁
|
||||
|
||||
.form-group
|
||||
label Blink cursor
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.cursorBlink',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='false'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='true'
|
||||
)
|
||||
| On
|
||||
.col-md-6
|
||||
.form-group
|
||||
.appearance-preview(
|
||||
@@ -7,6 +160,8 @@ h3.mb-2 Appearance
|
||||
[style.font-size]='config.store.terminal.fontSize + "px"',
|
||||
[style.background-color]='(config.store.terminal.background == "theme") ? null : config.store.terminal.colorScheme.background',
|
||||
[style.color]='config.store.terminal.colorScheme.foreground',
|
||||
[style.font-feature-settings]='\'"liga" \' + config.store.terminal.ligatures ? 1 : 0',
|
||||
[style.font-variant-ligatures]='config.store.terminal.ligatures ? "initial" : "none"',
|
||||
)
|
||||
div
|
||||
span([style.background-color]='config.store.terminal.colorScheme.colors[0]')
|
||||
@@ -85,298 +240,127 @@ h3.mb-2 Appearance
|
||||
span rm -rf /
|
||||
span([style.background-color]='config.store.terminal.colorScheme.cursor')
|
||||
|
||||
h3.mt-3.mb-3 Shell
|
||||
|
||||
.col-md-6
|
||||
.form-group
|
||||
label Font
|
||||
.row
|
||||
.col-8
|
||||
input.form-control(
|
||||
type='text',
|
||||
[ngbTypeahead]='fontAutocomplete',
|
||||
'[(ngModel)]'='config.store.terminal.font',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
.col-4
|
||||
input.form-control(
|
||||
type='number',
|
||||
'[(ngModel)]'='config.store.terminal.fontSize',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
small.form-text.text-muted Font to be used in the terminal
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Shell
|
||||
select.form-control(
|
||||
[(ngModel)]='config.store.terminal.shell',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option(
|
||||
*ngFor='let shell of shells',
|
||||
[ngValue]='shell.id'
|
||||
) {{shell.name}}
|
||||
|
||||
.form-group(*ngIf='!editingColorScheme')
|
||||
label Color scheme
|
||||
.input-group
|
||||
select.form-control(
|
||||
[compareWith]='equalComparator',
|
||||
'[(ngModel)]'='config.store.terminal.colorScheme',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option(*ngFor='let scheme of config.store.terminal.customColorSchemes', [ngValue]='scheme') Custom: {{scheme.name}}
|
||||
option(*ngFor='let scheme of colorSchemes', [ngValue]='scheme') {{scheme.name}}
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='editScheme(config.store.terminal.colorScheme)') Edit
|
||||
.input-group-btn
|
||||
button.btn.btn-outline-danger(
|
||||
(click)='deleteScheme(config.store.terminal.colorScheme)',
|
||||
*ngIf='isCustomScheme(config.store.terminal.colorScheme)'
|
||||
)
|
||||
i.fa.fa-trash-o
|
||||
|
||||
.form-group(*ngIf='editingColorScheme')
|
||||
label Editing
|
||||
.input-group
|
||||
input.form-control(type='text', '[(ngModel)]'='editingColorScheme.name')
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='saveScheme()') Save
|
||||
.input-group-btn
|
||||
button.btn.btn-secondary((click)='cancelEditing()') Cancel
|
||||
|
||||
|
||||
.form-group(*ngIf='editingColorScheme')
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.foreground',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='FG',
|
||||
)
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.background',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='BG',
|
||||
)
|
||||
color-picker(
|
||||
'[(model)]'='editingColorScheme.cursor',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
title='CU',
|
||||
)
|
||||
color-picker(
|
||||
*ngFor='let _ of editingColorScheme.colors; let idx = index; trackBy: colorsTrackBy',
|
||||
'[(model)]'='editingColorScheme.colors[idx]',
|
||||
(modelChange)='config.save(); schemeChanged = true',
|
||||
[title]='idx',
|
||||
)
|
||||
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Terminal background
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.background',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"theme"'
|
||||
)
|
||||
| From theme
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"colorScheme"'
|
||||
)
|
||||
| From colors
|
||||
|
||||
.form-group
|
||||
label Cursor shape
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.cursor',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"block"'
|
||||
)
|
||||
| █
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"beam"'
|
||||
)
|
||||
| |
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"underline"'
|
||||
)
|
||||
| ▁
|
||||
|
||||
h3.mt-2.mb-2 Behaviour
|
||||
|
||||
.row
|
||||
.col-md-6
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Shell
|
||||
select.form-control(
|
||||
'[(ngModel)]'='config.store.terminal.shell',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option(
|
||||
*ngFor='let shell of shells',
|
||||
[ngValue]='shell.id'
|
||||
) {{shell.name}}
|
||||
|
||||
.form-group
|
||||
label Session persistence
|
||||
select.form-control(
|
||||
'[(ngModel)]'='config.store.terminal.persistence',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option([ngValue]='null') Off
|
||||
option(
|
||||
*ngFor='let provider of persistenceProviders',
|
||||
[ngValue]='provider.id'
|
||||
) {{provider.displayName}}
|
||||
|
||||
.form-group(*ngIf='config.store.terminal.shell == "custom"')
|
||||
label Custom shell
|
||||
input.form-control(
|
||||
type='text',
|
||||
'[(ngModel)]'='config.store.terminal.customShell',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.form-group
|
||||
label Working directory
|
||||
input.form-control(
|
||||
type='text',
|
||||
placeholder='Home directory',
|
||||
'[(ngModel)]'='config.store.terminal.workingDirectory',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.form-group
|
||||
label Auto-open a terminal on app start
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.autoOpen',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='false'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='true'
|
||||
)
|
||||
| On
|
||||
.form-group.mr-3(*ngIf='persistenceProviders.length > 0')
|
||||
label Session persistence
|
||||
select.form-control(
|
||||
[(ngModel)]='config.store.terminal.persistence',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
option([ngValue]='null') Off
|
||||
option(
|
||||
*ngFor='let provider of persistenceProviders',
|
||||
[ngValue]='provider.id'
|
||||
) {{provider.displayName}}
|
||||
|
||||
.col-md-6
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Terminal bell
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.bell',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"off"'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"visual"'
|
||||
)
|
||||
| Visual
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"audible"'
|
||||
)
|
||||
| Audible
|
||||
.form-group
|
||||
label Working directory
|
||||
input.form-control(
|
||||
type='text',
|
||||
placeholder='Home directory',
|
||||
[(ngModel)]='config.store.terminal.workingDirectory',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.form-group(*ngIf='config.store.terminal.shell == "custom"')
|
||||
label Custom shell
|
||||
input.form-control(
|
||||
type='text',
|
||||
[(ngModel)]='config.store.terminal.customShell',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
|
||||
.form-group
|
||||
label Blink cursor
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.cursorBlink',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='false'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='true'
|
||||
)
|
||||
| On
|
||||
h3.mt-3.mb-3 Behaviour
|
||||
|
||||
.d-flex
|
||||
.form-group.mr-3
|
||||
label Copy on select
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.copyOnSelect',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='false'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='true'
|
||||
)
|
||||
| On
|
||||
|
||||
.form-group
|
||||
label Right click behaviour
|
||||
br
|
||||
.btn-group(
|
||||
'[(ngModel)]'='config.store.terminal.rightClick',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
value='menu'
|
||||
)
|
||||
| Menu
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
value='paste'
|
||||
)
|
||||
| Paste
|
||||
.form-group
|
||||
label Terminal bell
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.bell',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"off"'
|
||||
)
|
||||
| Off
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"visual"'
|
||||
)
|
||||
| Visual
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"audible"'
|
||||
)
|
||||
| Audible
|
||||
|
||||
.form-group
|
||||
label Right click
|
||||
br
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.terminal.rightClick',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
value='menu'
|
||||
)
|
||||
| Context menu
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
value='paste'
|
||||
)
|
||||
| Paste
|
||||
|
||||
|
||||
.form-group
|
||||
checkbox(
|
||||
[(ngModel)]='config.store.terminal.autoOpen',
|
||||
(ngModelChange)='config.save()',
|
||||
text='Auto-open a terminal on app start',
|
||||
)
|
||||
|
||||
checkbox(
|
||||
[(ngModel)]='config.store.terminal.bracketedPaste',
|
||||
(ngModelChange)='config.save()',
|
||||
text='Bracketed paste (requires shell support)',
|
||||
)
|
||||
|
||||
checkbox(
|
||||
[(ngModel)]='config.store.terminal.copyOnSelect',
|
||||
(ngModelChange)='config.save()',
|
||||
text='Copy on select',
|
||||
)
|
||||
|
||||
checkbox(
|
||||
[(ngModel)]='config.store.terminal.altIsMeta',
|
||||
(ngModelChange)='config.save()',
|
||||
text='Use Alt key as the Meta key',
|
||||
)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
.appearance-preview {
|
||||
padding: 10px 20px;
|
||||
padding: 10px 0;
|
||||
margin-left: 30px;
|
||||
margin: 0 0 10px;
|
||||
overflow: hidden;
|
||||
span {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Observable } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'
|
||||
import { exec } from 'mz/child_process'
|
||||
const equal = require('deep-equal')
|
||||
const fontManager = require('font-manager')
|
||||
@@ -51,11 +52,12 @@ export class TerminalSettingsTabComponent {
|
||||
}
|
||||
|
||||
fontAutocomplete = (text$: Observable<string>) => {
|
||||
return text$
|
||||
.debounceTime(200)
|
||||
.distinctUntilChanged()
|
||||
.map(query => this.fonts.filter(v => new RegExp(query, 'gi').test(v)))
|
||||
.map(list => Array.from(new Set(list)))
|
||||
return text$.pipe(
|
||||
debounceTime(200),
|
||||
distinctUntilChanged(),
|
||||
map(query => this.fonts.filter(v => new RegExp(query, 'gi').test(v))),
|
||||
map(list => Array.from(new Set(list))),
|
||||
)
|
||||
}
|
||||
|
||||
editScheme (scheme: ITerminalColorScheme) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { BehaviorSubject, Subject, Subscription } from 'rxjs'
|
||||
import 'rxjs/add/operator/bufferTime'
|
||||
import { Observable, BehaviorSubject, Subject, Subscription } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { ToastrService } from 'ngx-toastr'
|
||||
import { Component, NgZone, Inject, Optional, ViewChild, HostBinding, Input } from '@angular/core'
|
||||
import { AppService, ConfigService, BaseTabComponent, ElectronService, ThemesService, HostAppService, HotkeysService, Platform } from 'terminus-core'
|
||||
|
||||
@@ -32,7 +33,8 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
hotkeysSubscription: Subscription
|
||||
bell$ = new Subject()
|
||||
size: ResizeEvent
|
||||
resize$ = new Subject<ResizeEvent>()
|
||||
resize$: Observable<ResizeEvent>
|
||||
private resize_ = new Subject<ResizeEvent>()
|
||||
input$ = new Subject<string>()
|
||||
output$ = new Subject<string>()
|
||||
contentUpdated$ = new Subject<void>()
|
||||
@@ -54,12 +56,14 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
private electron: ElectronService,
|
||||
private terminalService: TerminalService,
|
||||
public config: ConfigService,
|
||||
private toastr: ToastrService,
|
||||
@Optional() @Inject(TerminalDecorator) private decorators: TerminalDecorator[],
|
||||
) {
|
||||
super()
|
||||
this.resize$ = this.resize_.asObservable()
|
||||
this.decorators = this.decorators || []
|
||||
this.title = 'Terminal'
|
||||
this.resize$.first().subscribe(async (resizeEvent) => {
|
||||
this.setTitle('Terminal')
|
||||
this.resize$.pipe(first()).subscribe(async resizeEvent => {
|
||||
if (!this.session) {
|
||||
this.session = this.sessions.addSession(
|
||||
Object.assign({}, this.sessionOptions, resizeEvent)
|
||||
@@ -89,39 +93,50 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
return
|
||||
}
|
||||
switch (hotkey) {
|
||||
case 'copy':
|
||||
case 'ctrl-c':
|
||||
if (this.hterm.getSelectionText()) {
|
||||
this.hterm.copySelectionToClipboard()
|
||||
break
|
||||
case 'clear':
|
||||
this.clear()
|
||||
break
|
||||
case 'zoom-in':
|
||||
this.zoomIn()
|
||||
break
|
||||
case 'zoom-out':
|
||||
this.zoomOut()
|
||||
break
|
||||
case 'reset-zoom':
|
||||
this.resetZoom()
|
||||
break
|
||||
case 'home':
|
||||
this.sendInput('\x1bOH')
|
||||
break
|
||||
case 'end':
|
||||
this.sendInput('\x1bOF')
|
||||
break
|
||||
case 'previous-word':
|
||||
this.sendInput('\x1bb')
|
||||
break
|
||||
case 'next-word':
|
||||
this.sendInput('\x1bf')
|
||||
break
|
||||
case 'delete-previous-word':
|
||||
this.sendInput('\x1b\x7f')
|
||||
break
|
||||
case 'delete-next-word':
|
||||
this.sendInput('\x1bd')
|
||||
break
|
||||
this.hterm.getDocument().getSelection().removeAllRanges()
|
||||
} else {
|
||||
this.sendInput('\x03')
|
||||
}
|
||||
break
|
||||
case 'copy':
|
||||
this.hterm.copySelectionToClipboard()
|
||||
break
|
||||
case 'paste':
|
||||
this.paste()
|
||||
break
|
||||
case 'clear':
|
||||
this.clear()
|
||||
break
|
||||
case 'zoom-in':
|
||||
this.zoomIn()
|
||||
break
|
||||
case 'zoom-out':
|
||||
this.zoomOut()
|
||||
break
|
||||
case 'reset-zoom':
|
||||
this.resetZoom()
|
||||
break
|
||||
case 'home':
|
||||
this.sendInput('\x1bOH')
|
||||
break
|
||||
case 'end':
|
||||
this.sendInput('\x1bOF')
|
||||
break
|
||||
case 'previous-word':
|
||||
this.sendInput('\x1bb')
|
||||
break
|
||||
case 'next-word':
|
||||
this.sendInput('\x1bf')
|
||||
break
|
||||
case 'delete-previous-word':
|
||||
this.sendInput('\x1b\x7f')
|
||||
break
|
||||
case 'delete-next-word':
|
||||
this.sendInput('\x1bd')
|
||||
break
|
||||
}
|
||||
})
|
||||
this.bellPlayer = document.createElement('audio')
|
||||
@@ -211,11 +226,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
}
|
||||
|
||||
attachHTermHandlers (hterm: any) {
|
||||
hterm.setWindowTitle = (title) => {
|
||||
this.zone.run(() => {
|
||||
this.title = title
|
||||
})
|
||||
}
|
||||
hterm.setWindowTitle = title => this.zone.run(() => this.setTitle(title))
|
||||
|
||||
const _setAlternateMode = hterm.setAlternateMode.bind(hterm)
|
||||
hterm.setAlternateMode = (state) => {
|
||||
@@ -223,15 +234,18 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
this.alternateScreenActive$.next(state)
|
||||
}
|
||||
|
||||
const _copySelectionToClipboard = hterm.copySelectionToClipboard.bind(hterm)
|
||||
hterm.copySelectionToClipboard = () => {
|
||||
_copySelectionToClipboard()
|
||||
this.toastr.info('Copied')
|
||||
}
|
||||
|
||||
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) => {
|
||||
hterm.scrollPort_.pasteTarget_.value = event.clipboardData.getData('text/plain').trim()
|
||||
_onPaste()
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
@@ -319,7 +333,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (this.session) {
|
||||
this.session.resize(columns, rows)
|
||||
}
|
||||
this.resize$.next(this.size)
|
||||
this.resize_.next(this.size)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -333,7 +347,13 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
}
|
||||
|
||||
paste () {
|
||||
this.sendInput(this.electron.clipboard.readText())
|
||||
let data = this.electron.clipboard.readText()
|
||||
data = this.hterm.keyboard.encode(data)
|
||||
if (this.hterm.options_.bracketedPaste) {
|
||||
data = '\x1b[200~' + data + '\x1b[201~'
|
||||
}
|
||||
data = data.replace(/\r\n/g, '\n')
|
||||
this.sendInput(data)
|
||||
}
|
||||
|
||||
clear () {
|
||||
@@ -354,10 +374,12 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
preferenceManager.set('ctrl-plus-minus-zero-zoom', false)
|
||||
preferenceManager.set('scrollbar-visible', this.hostApp.platform === Platform.macOS)
|
||||
preferenceManager.set('copy-on-select', config.terminal.copyOnSelect)
|
||||
preferenceManager.set('alt-is-meta', config.terminal.altIsMeta)
|
||||
preferenceManager.set('alt-sends-what', 'browser-key')
|
||||
preferenceManager.set('alt-gr-mode', 'ctrl-alt')
|
||||
preferenceManager.set('pass-alt-number', true)
|
||||
preferenceManager.set('cursor-blink', config.terminal.cursorBlink)
|
||||
preferenceManager.set('clear-selection-after-copy', true)
|
||||
|
||||
if (config.terminal.colorScheme.foreground) {
|
||||
preferenceManager.set('foreground-color', config.terminal.colorScheme.foreground)
|
||||
@@ -433,7 +455,7 @@ export class TerminalTabComponent extends BaseTabComponent {
|
||||
if (this.sessionCloseSubscription) {
|
||||
this.sessionCloseSubscription.unsubscribe()
|
||||
}
|
||||
this.resize$.complete()
|
||||
this.resize_.complete()
|
||||
this.input$.complete()
|
||||
this.output$.complete()
|
||||
this.contentUpdated$.complete()
|
||||
|
@@ -16,6 +16,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
rightClick: 'menu',
|
||||
copyOnSelect: false,
|
||||
workingDirectory: '',
|
||||
altIsMeta: false,
|
||||
colorScheme: {
|
||||
__nonStructural: true,
|
||||
name: 'Material',
|
||||
@@ -53,9 +54,13 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
persistence: 'screen',
|
||||
},
|
||||
hotkeys: {
|
||||
'ctrl-c': ['Ctrl-C'],
|
||||
'copy': [
|
||||
'⌘-C',
|
||||
],
|
||||
'paste': [
|
||||
'⌘-V',
|
||||
],
|
||||
'clear': [
|
||||
'⌘-K',
|
||||
],
|
||||
@@ -93,9 +98,13 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
copyOnSelect: true,
|
||||
},
|
||||
hotkeys: {
|
||||
'ctrl-c': ['Ctrl-C'],
|
||||
'copy': [
|
||||
'Ctrl-Shift-C',
|
||||
],
|
||||
'paste': [
|
||||
'Ctrl-Shift-V',
|
||||
],
|
||||
'clear': [
|
||||
'Ctrl-L',
|
||||
],
|
||||
@@ -130,9 +139,13 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
persistence: 'tmux',
|
||||
},
|
||||
hotkeys: {
|
||||
'ctrl-c': ['Ctrl-C'],
|
||||
'copy': [
|
||||
'Ctrl-Shift-C',
|
||||
],
|
||||
'paste': [
|
||||
'Ctrl-Shift-V',
|
||||
],
|
||||
'clear': [
|
||||
'Ctrl-L',
|
||||
],
|
||||
|
@@ -8,6 +8,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
|
||||
id: 'copy',
|
||||
name: 'Copy to clipboard',
|
||||
},
|
||||
{
|
||||
id: 'paste',
|
||||
name: 'Paste from clipboard',
|
||||
},
|
||||
{
|
||||
id: 'home',
|
||||
name: 'Beginning of the line',
|
||||
@@ -52,5 +56,9 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
|
||||
id: 'new-tab',
|
||||
name: 'New tab',
|
||||
},
|
||||
{
|
||||
id: 'ctrl-c',
|
||||
name: 'Intelligent Ctrl-C (copy/abort)',
|
||||
},
|
||||
]
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@ 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'
|
||||
import TerminusCorePlugin from 'terminus-core'
|
||||
|
||||
import { ToolbarButtonProvider, TabRecoveryProvider, ConfigProvider, HotkeysService, HotkeyProvider, AppService, ConfigService } from 'terminus-core'
|
||||
import { SettingsTabProvider } from 'terminus-settings'
|
||||
@@ -24,6 +26,7 @@ import { TerminalConfigProvider } from './config'
|
||||
import { TerminalHotkeyProvider } from './hotkeys'
|
||||
import { HyperColorSchemes } from './colorSchemes'
|
||||
|
||||
import { CmderShellProvider } from './shells/cmder'
|
||||
import { CustomShellProvider } from './shells/custom'
|
||||
import { Cygwin32ShellProvider } from './shells/cygwin32'
|
||||
import { Cygwin64ShellProvider } from './shells/cygwin64'
|
||||
@@ -41,6 +44,8 @@ import { hterm } from './hterm'
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
NgbModule,
|
||||
ToastrModule,
|
||||
TerminusCorePlugin,
|
||||
],
|
||||
providers: [
|
||||
SessionsService,
|
||||
@@ -57,6 +62,7 @@ import { hterm } from './hterm'
|
||||
{ provide: SessionPersistenceProvider, useClass: ScreenPersistenceProvider, multi: true },
|
||||
{ provide: SessionPersistenceProvider, useClass: TMuxPersistenceProvider, multi: true },
|
||||
|
||||
{ provide: ShellProvider, useClass: CmderShellProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: WindowsStockShellsProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: MacOSDefaultShellProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: LinuxDefaultShellProvider, multi: true },
|
||||
|
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'
|
||||
import { execFileSync } from 'child_process'
|
||||
import * as AsyncLock from 'async-lock'
|
||||
import { ConnectableObservable, AsyncSubject, Subject } from 'rxjs'
|
||||
import { first, publish } from 'rxjs/operators'
|
||||
import * as childProcess from 'child_process'
|
||||
|
||||
import { Logger } from 'terminus-core'
|
||||
@@ -102,7 +103,7 @@ export class TMuxCommandProcess {
|
||||
}
|
||||
})
|
||||
|
||||
this.response$ = this.block$.publish()
|
||||
this.response$ = this.block$.asObservable().pipe(publish()) as ConnectableObservable<TMuxBlock>
|
||||
this.response$.connect()
|
||||
|
||||
this.block$.subscribe(block => {
|
||||
@@ -116,7 +117,7 @@ export class TMuxCommandProcess {
|
||||
|
||||
command (command: string): Promise<TMuxBlock> {
|
||||
return this.lock.acquire('key', () => {
|
||||
let p = this.response$.take(1).toPromise()
|
||||
let p = this.response$.pipe(first()).toPromise()
|
||||
this.logger.debug('command:', command)
|
||||
this.process.stdin.write(command + '\n')
|
||||
return p
|
||||
|
@@ -1,7 +1,8 @@
|
||||
const psNode = require('ps-node')
|
||||
let nodePTY
|
||||
import * as fs from 'mz/fs'
|
||||
import { Subject } from 'rxjs'
|
||||
import { Observable, Subject } from 'rxjs'
|
||||
import { first } from 'rxjs/operators'
|
||||
import { Injectable, Inject } from '@angular/core'
|
||||
import { Logger, LogService, ElectronService, ConfigService } from 'terminus-core'
|
||||
import { exec } from 'mz/child_process'
|
||||
@@ -17,25 +18,34 @@ export interface IChildProcess {
|
||||
export abstract class BaseSession {
|
||||
open: boolean
|
||||
name: string
|
||||
output$ = new Subject<string>()
|
||||
closed$ = new Subject<void>()
|
||||
destroyed$ = new Subject<void>()
|
||||
recoveryId: string
|
||||
truePID: number
|
||||
output$: Observable<string>
|
||||
closed$: Observable<void>
|
||||
destroyed$: Observable<void>
|
||||
protected output_ = new Subject<string>()
|
||||
protected closed_ = new Subject<void>()
|
||||
protected destroyed_ = new Subject<void>()
|
||||
private initialDataBuffer = ''
|
||||
private initialDataBufferReleased = false
|
||||
|
||||
constructor () {
|
||||
this.output$ = this.output_.asObservable()
|
||||
this.closed$ = this.closed_.asObservable()
|
||||
this.destroyed$ = this.destroyed_.asObservable()
|
||||
}
|
||||
|
||||
emitOutput (data: string) {
|
||||
if (!this.initialDataBufferReleased) {
|
||||
this.initialDataBuffer += data
|
||||
} else {
|
||||
this.output$.next(data)
|
||||
this.output_.next(data)
|
||||
}
|
||||
}
|
||||
|
||||
releaseInitialDataBuffer () {
|
||||
this.initialDataBufferReleased = true
|
||||
this.output$.next(this.initialDataBuffer)
|
||||
this.output_.next(this.initialDataBuffer)
|
||||
this.initialDataBuffer = null
|
||||
}
|
||||
|
||||
@@ -49,9 +59,9 @@ export abstract class BaseSession {
|
||||
async destroy (): Promise<void> {
|
||||
if (this.open) {
|
||||
this.open = false
|
||||
this.closed$.next()
|
||||
this.destroyed$.next()
|
||||
this.output$.complete()
|
||||
this.closed_.next()
|
||||
this.destroyed_.next()
|
||||
this.output_.complete()
|
||||
await this.gracefullyKillProcess()
|
||||
}
|
||||
}
|
||||
@@ -100,7 +110,7 @@ export class Session extends BaseSession {
|
||||
|
||||
this.open = true
|
||||
|
||||
this.pty.on('data', data => {
|
||||
this.pty.on('data-buffered', data => {
|
||||
this.emitOutput(data)
|
||||
})
|
||||
|
||||
@@ -200,7 +210,8 @@ export class SessionsService {
|
||||
electron: ElectronService,
|
||||
log: LogService,
|
||||
) {
|
||||
nodePTY = electron.remoteRequirePluginModule('terminus-terminal', 'node-pty-tmp', global as any)
|
||||
const nodePTYPath = electron.remoteResolvePluginModule('terminus-terminal', 'node-pty-tmp', global as any)
|
||||
nodePTY = electron.remoteRequire('./bufferizedPTY')(nodePTYPath)
|
||||
this.logger = log.create('sessions')
|
||||
this.persistenceProviders = this.config.enabledServices(this.persistenceProviders).filter(x => x.isAvailable())
|
||||
}
|
||||
@@ -219,7 +230,7 @@ export class SessionsService {
|
||||
options.name = `session-${this.lastID}`
|
||||
let session = new Session(options)
|
||||
let persistence = this.getPersistence()
|
||||
session.destroyed$.first().subscribe(() => {
|
||||
session.destroyed$.pipe(first()).subscribe(() => {
|
||||
delete this.sessions[session.name]
|
||||
if (persistence) {
|
||||
persistence.terminateSession(session.recoveryId)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { AsyncSubject } from 'rxjs'
|
||||
import { Observable, AsyncSubject } from 'rxjs'
|
||||
import { Injectable, Inject } from '@angular/core'
|
||||
import { AppService, Logger, LogService, ConfigService } from 'terminus-core'
|
||||
import { IShell, ShellProvider } from '../api'
|
||||
@@ -7,7 +7,8 @@ import { TerminalTabComponent } from '../components/terminalTab.component'
|
||||
|
||||
@Injectable()
|
||||
export class TerminalService {
|
||||
shells$ = new AsyncSubject<IShell[]>()
|
||||
shells$: Observable<IShell[]>
|
||||
private shells_ = new AsyncSubject<IShell[]>()
|
||||
private logger: Logger
|
||||
|
||||
constructor (
|
||||
@@ -26,10 +27,11 @@ export class TerminalService {
|
||||
}
|
||||
|
||||
async reloadShells () {
|
||||
this.shells$ = new AsyncSubject<IShell[]>()
|
||||
this.shells_ = new AsyncSubject<IShell[]>()
|
||||
this.shells$ = this.shells_.asObservable()
|
||||
let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
|
||||
this.shells$.next(shellLists.reduce((a, b) => a.concat(b)))
|
||||
this.shells$.complete()
|
||||
this.shells_.next(shellLists.reduce((a, b) => a.concat(b)))
|
||||
this.shells_.complete()
|
||||
}
|
||||
|
||||
async openTab (shell?: IShell, cwd?: string): Promise<TerminalTabComponent> {
|
||||
|
38
terminus-terminal/src/shells/cmder.ts
Normal file
38
terminus-terminal/src/shells/cmder.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class CmderShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
private hostApp: HostAppService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
async provide (): Promise<IShell[]> {
|
||||
if (this.hostApp.platform !== Platform.Windows) {
|
||||
return []
|
||||
}
|
||||
|
||||
if (!process.env.CMDER_ROOT) {
|
||||
return []
|
||||
}
|
||||
|
||||
return [{
|
||||
id: 'cmder',
|
||||
name: 'Cmder',
|
||||
command: 'cmd.exe',
|
||||
args: [
|
||||
'/k',
|
||||
path.join(process.env.CMDER_ROOT, 'vendor', 'init.bat'),
|
||||
],
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
@@ -18,27 +18,31 @@ module.exports = {
|
||||
extensions: ['.ts', '.js'],
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
}
|
||||
use: {
|
||||
loader: 'awesome-typescript-loader',
|
||||
query: {
|
||||
configFileName: path.resolve(__dirname, 'tsconfig.json'),
|
||||
typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
|
||||
paths: {
|
||||
"terminus-*": [path.resolve(__dirname, '../terminus-*')],
|
||||
"*": [path.resolve(__dirname, '../app/node_modules/*')],
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{ 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|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
|
||||
loader: "url-loader",
|
||||
options: {
|
||||
limit: 999999999999,
|
||||
use: {
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 999999999999,
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
@@ -55,6 +59,7 @@ module.exports = {
|
||||
/^rxjs/,
|
||||
/^@angular/,
|
||||
/^@ng-bootstrap/,
|
||||
'ngx-toastr',
|
||||
/^terminus-/,
|
||||
],
|
||||
plugins: [
|
||||
|
@@ -62,14 +62,14 @@ file-loader@^0.11.2:
|
||||
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"
|
||||
font-manager@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/font-manager/-/font-manager-0.3.0.tgz#9efdc13e521a3d8752e7ab56c3938818043a311f"
|
||||
dependencies:
|
||||
nan "~2.2.0"
|
||||
nan ">=2.10.0"
|
||||
|
||||
hterm-umdjs@1.1.3:
|
||||
version "1.1.3+1.58.sha.15ed490"
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/hterm-umdjs/-/hterm-umdjs-1.1.3.tgz#8b57bcaded5ba9541d6c8e32a82b34abb93e885e"
|
||||
|
||||
json5@^0.5.0:
|
||||
@@ -92,14 +92,14 @@ mz@^2.6.0:
|
||||
object-assign "^4.0.1"
|
||||
thenify-all "^1.0.0"
|
||||
|
||||
nan@>=2.10.0:
|
||||
version "2.10.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"
|
||||
|
||||
nan@^2.6.2:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46"
|
||||
|
||||
nan@~2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.2.1.tgz#d68693f6b34bb41d66bc68b3a4f9defc79d7149b"
|
||||
|
||||
node-pty-tmp@0.7.1:
|
||||
version "0.7.1"
|
||||
resolved "https://registry.yarnpkg.com/node-pty-tmp/-/node-pty-tmp-0.7.1.tgz#0a81179f9087b21f968206c886e543db20650d7a"
|
||||
|
@@ -2,9 +2,9 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2016",
|
||||
"declaration": false,
|
||||
"noImplicitAny": false,
|
||||
"removeComments": false,
|
||||
"emitDeclarationOnly": false,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
|
Reference in New Issue
Block a user