mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-30 22:17:00 +00:00
Compare commits
14 Commits
v1.0.0-alp
...
v1.0.0-alp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c84de4c39c | ||
![]() |
649eb63f9b | ||
![]() |
ffc68401a7 | ||
![]() |
ef7b1ad5d9 | ||
![]() |
5bd8fb63e5 | ||
![]() |
addf57960d | ||
![]() |
768d222d05 | ||
![]() |
07792c227e | ||
![]() |
d1e3f282a1 | ||
![]() |
a18124043c | ||
![]() |
b3abe32321 | ||
![]() |
665a8e714e | ||
![]() |
2ec3833977 | ||
![]() |
73eb8bdbe7 |
@@ -118,3 +118,5 @@ export default class MyModule { }
|
||||
|
||||
|
||||
See `terminus-core/src/api.ts`, `terminus-settings/src/api.ts` and `terminus-terminal/src/api.ts` for the available extension points.
|
||||
|
||||
Publish your plugin on NPM with a `terminus-plugin` keyword to make it appear in the Plugin Manager.
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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
|
||||
* PowerShell Core, WSL (Bash on Windows), PowerShell, Git-Bash, Cygwin, Cmder and CMD support
|
||||
* Tab persistence on macOS and Linux
|
||||
|
||||
---
|
||||
@@ -34,9 +34,9 @@ Plugins can be installed directly from the Settings view inside Terminus.
|
||||
|
||||
# Contributing
|
||||
|
||||
Pull requests and plugins are welcome! Publish your plugin on NPM with a `terminus-plugin` keyword to make it appear in the Plugin Manager.
|
||||
Pull requests and plugins are welcome!
|
||||
|
||||
See [HACKING.md](https://github.com/Eugeny/terminus/blob/master/HACKING.md) for a very brief plugin development tutorial!
|
||||
See [HACKING.md](https://github.com/Eugeny/terminus/blob/master/HACKING.md) for information of how the project is laid out, and a very brief plugin development tutorial.
|
||||
|
||||
|
||||
## License
|
||||
|
@@ -29,7 +29,7 @@
|
||||
"mz": "^2.6.0",
|
||||
"ngx-toastr": "^8.7.3",
|
||||
"path": "0.12.7",
|
||||
"rxjs": "^6.1.0",
|
||||
"rxjs": "^6.3.3",
|
||||
"yargs": "^12.0.1",
|
||||
"zone.js": "~0.8.26"
|
||||
},
|
||||
|
@@ -426,9 +426,9 @@ require-main-filename@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
|
||||
|
||||
rxjs@^6.1.0:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.1.0.tgz#833447de4e4f6427b9cec3e5eb9f56415cd28315"
|
||||
rxjs@^6.3.3:
|
||||
version "6.3.3"
|
||||
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55"
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 112 KiB |
@@ -1,92 +1,16 @@
|
||||
<?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>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 426 426" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
|
||||
<g id="Layer-1" serif:id="Layer 1" transform="matrix(1,0,0,1,-29.3571,-233.318)">
|
||||
<g>
|
||||
<path id="path138" d="M93.68,293.848L287.16,405.423L229.046,438.975L93.68,356.409L93.68,293.848Z" style="fill:url(#_Linear1);"/>
|
||||
<path id="path118" d="M94.204,516.708L153.711,551.064L153.721,613.886L94.204,579.325L94.204,516.708Z" style="fill:url(#_Linear2);"/>
|
||||
</g>
|
||||
<path id="path116" d="M401.384,408.07L401.529,473.724L153.721,613.83L153.712,551.008L401.384,408.07Z" style="fill:rgb(0,94,167);fill-opacity:0.9;"/>
|
||||
<path id="path134" d="M148.072,261.343L92.84,293.232L287.16,405.423L93.366,517.309L153.198,551.853L346.992,439.967L402.224,408.078L148.072,261.343Z" style="fill:rgb(7,147,255);fill-opacity:0.9;"/>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(193.48,0,0,320.038,93.6796,453.867)"><stop offset="0" style="stop-color:rgb(0,121,215);stop-opacity:0.9"/><stop offset="1" style="stop-color:rgb(40,97,156);stop-opacity:0.9"/></linearGradient>
|
||||
<linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(193.48,0,0,320.038,93.6796,453.867)"><stop offset="0" style="stop-color:rgb(0,121,215);stop-opacity:0.9"/><stop offset="1" style="stop-color:rgb(40,97,156);stop-opacity:0.9"/></linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -5,7 +5,7 @@
|
||||
"@types/electron-debug": "^1.1.0",
|
||||
"@types/fs-promise": "1.0.1",
|
||||
"@types/js-yaml": "^3.11.2",
|
||||
"@types/node": "7.0.5",
|
||||
"@types/node": "^10.11.5",
|
||||
"@types/webpack-env": "1.13.0",
|
||||
"apply-loader": "0.1.0",
|
||||
"awesome-typescript-loader": "^5.0.0",
|
||||
@@ -18,7 +18,7 @@
|
||||
"css-loader": "0.28.0",
|
||||
"electron": "3.0.0",
|
||||
"electron-builder": "^20.27.1",
|
||||
"electron-builder-squirrel-windows": "17.0.1",
|
||||
"electron-builder-squirrel-windows": "^20.28.3",
|
||||
"electron-installer-snap": "^3.0.0",
|
||||
"electron-rebuild": "^1.8.2",
|
||||
"eslint": "^5.4.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"node-gyp": "^3.6.2",
|
||||
"node-sass": "^4.5.3",
|
||||
"npmlog": "4.1.0",
|
||||
"npx": "^9.7.1",
|
||||
"npx": "^10.2.0",
|
||||
"pug": "^2.0.3",
|
||||
"pug-html-loader": "1.0.9",
|
||||
"pug-lint": "^2.5.0",
|
||||
@@ -56,7 +56,7 @@
|
||||
"tslint-config-standard": "5.0.2",
|
||||
"tslint-eslint-rules": "4.0.0",
|
||||
"typescript": "^2.8.3",
|
||||
"url-loader": "0.5.7",
|
||||
"url-loader": "^1.1.1",
|
||||
"val-loader": "0.5.0",
|
||||
"webpack": "^4.8.3",
|
||||
"webpack-cli": "^2.1.3",
|
||||
|
@@ -27,6 +27,7 @@
|
||||
"electron-updater": "^2.8.9",
|
||||
"ng2-dnd": "^5.0.2",
|
||||
"ngx-perfect-scrollbar": "^6.0.0",
|
||||
"rage-edit": "^1.1.0",
|
||||
"shell-escape": "^0.2.0",
|
||||
"universal-analytics": "^0.4.17"
|
||||
},
|
||||
@@ -43,7 +44,6 @@
|
||||
"dependencies": {
|
||||
"deepmerge": "^1.5.0",
|
||||
"js-yaml": "^3.9.0",
|
||||
"winreg": "^1.2.4",
|
||||
"winston": "^2.4.0"
|
||||
},
|
||||
"false": {}
|
||||
|
@@ -61,8 +61,7 @@ $tab-border-radius: 4px;
|
||||
-webkit-app-region: drag;
|
||||
|
||||
&.persistent {
|
||||
min-width: 100px;
|
||||
flex: 1 0 25%;
|
||||
min-width: 72px; // 2 x 36 px height, ie 2 squares
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,11 @@
|
||||
import * as path from 'path'
|
||||
import * as fs from 'mz/fs'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { exec } from 'mz/child_process'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ElectronService } from './electron.service'
|
||||
import { HostAppService, Platform } from './hostApp.service'
|
||||
|
||||
let Registry = null
|
||||
try {
|
||||
Registry = require('winreg')
|
||||
} catch (_) { } // tslint:disable-line no-empty
|
||||
|
||||
@Injectable()
|
||||
export class ShellIntegrationService {
|
||||
private automatorWorkflows = ['Open Terminus here.workflow', 'Paste path into Terminus.workflow']
|
||||
@@ -17,11 +13,11 @@ export class ShellIntegrationService {
|
||||
private automatorWorkflowsDestination: string
|
||||
private registryKeys = [
|
||||
{
|
||||
path: '\\Software\\Classes\\Directory\\Background\\shell\\Open Terminus here',
|
||||
path: 'HKCU\\Software\\Classes\\Directory\\Background\\shell\\Open Terminus here',
|
||||
command: 'open "%V"'
|
||||
},
|
||||
{
|
||||
path: '\\Software\\Classes\\*\\shell\\Paste path into Terminus',
|
||||
path: 'HKCU\\Software\\Classes\\*\\shell\\Paste path into Terminus',
|
||||
command: 'paste "%V"'
|
||||
},
|
||||
]
|
||||
@@ -54,10 +50,7 @@ export class ShellIntegrationService {
|
||||
if (this.hostApp.platform === Platform.macOS) {
|
||||
return await fs.exists(path.join(this.automatorWorkflowsDestination, this.automatorWorkflows[0]))
|
||||
} else if (this.hostApp.platform === Platform.Windows) {
|
||||
return await new Promise<boolean>(resolve => {
|
||||
let reg = new Registry({ hive: Registry.HKCU, key: this.registryKeys[0].path, arch: 'x64' })
|
||||
reg.keyExists((err, exists) => resolve(!err && exists))
|
||||
})
|
||||
return await Registry.has(this.registryKeys[0].path)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -69,26 +62,8 @@ export class ShellIntegrationService {
|
||||
}
|
||||
} else if (this.hostApp.platform === Platform.Windows) {
|
||||
for (let registryKey of this.registryKeys) {
|
||||
let reg = new Registry({ hive: Registry.HKCU, key: registryKey.path, arch: 'x64' })
|
||||
await new Promise(resolve => {
|
||||
reg.set('Icon', Registry.REG_SZ, this.electron.app.getPath('exe'), () => {
|
||||
reg.create(() => {
|
||||
let cmd = new Registry({
|
||||
hive: Registry.HKCU,
|
||||
key: registryKey.path + '\\command',
|
||||
arch: 'x64'
|
||||
})
|
||||
cmd.create(() => {
|
||||
cmd.set(
|
||||
'',
|
||||
Registry.REG_SZ,
|
||||
this.electron.app.getPath('exe') + ' ' + registryKey.command,
|
||||
() => resolve()
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
await Registry.set(registryKey.path, 'Icon', this.electron.app.getPath('exe'))
|
||||
await Registry.set(registryKey.path + '\\command', '', this.electron.app.getPath('exe') + ' ' + registryKey.command)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -414,6 +414,10 @@ qs@~6.5.1:
|
||||
version "6.5.2"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
|
||||
rage-edit@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rage-edit/-/rage-edit-1.1.0.tgz#8a5f0bf5c5ff4ab31ad086fa27a55be20fcd0357"
|
||||
|
||||
request@2.86.0:
|
||||
version "2.86.0"
|
||||
resolved "https://registry.yarnpkg.com/request/-/request-2.86.0.tgz#2b9497f449b0a32654c081a5cf426bbfb5bf5b69"
|
||||
@@ -549,10 +553,6 @@ verror@1.10.0:
|
||||
core-util-is "1.0.2"
|
||||
extsprintf "^1.2.0"
|
||||
|
||||
winreg@^1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
|
||||
|
||||
winston@^2.4.0:
|
||||
version "2.4.0"
|
||||
resolved "https://registry.yarnpkg.com/winston/-/winston-2.4.0.tgz#808050b93d52661ed9fb6c26b3f0c826708b0aee"
|
||||
|
@@ -44,7 +44,6 @@ module.exports = {
|
||||
'path',
|
||||
'mz/fs',
|
||||
'mz/child_process',
|
||||
'winreg',
|
||||
/^rxjs/,
|
||||
/^@angular/,
|
||||
/^@ng-bootstrap/,
|
||||
|
@@ -58,6 +58,10 @@ export class SSHModalComponent {
|
||||
this.close()
|
||||
this.ssh.connect(connection).catch(error => {
|
||||
this.toastr.error(`Could not connect: ${error}`)
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
this.app.activeTab.emitFocused()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -21,10 +21,10 @@
|
||||
"@types/mz": "0.0.31",
|
||||
"@types/node": "7.0.12",
|
||||
"@types/webpack-env": "1.13.0",
|
||||
"@types/winreg": "^1.2.30",
|
||||
"dataurl": "0.1.0",
|
||||
"deep-equal": "1.0.1",
|
||||
"file-loader": "^0.11.2",
|
||||
"rage-edit": "^1.1.0",
|
||||
"xterm": "^3.6.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -45,8 +45,7 @@
|
||||
"mz": "^2.6.0",
|
||||
"node-pty-tmp": "0.7.2",
|
||||
"ps-node": "^0.1.6",
|
||||
"runes": "^0.4.2",
|
||||
"winreg": "^1.2.3"
|
||||
"runes": "^0.4.2"
|
||||
},
|
||||
"false": {}
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ export interface IShell {
|
||||
command: string
|
||||
args?: string[]
|
||||
env?: any
|
||||
fsBase?: string
|
||||
}
|
||||
|
||||
export abstract class ShellProvider {
|
||||
|
@@ -1,14 +1,10 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
let Registry = null
|
||||
try {
|
||||
Registry = require('winreg')
|
||||
} catch (_) { } // tslint:disable-line no-empty
|
||||
|
||||
@Injectable()
|
||||
export class Cygwin32ShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
@@ -22,15 +18,7 @@ export class Cygwin32ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = await new Promise<string>(resolve => {
|
||||
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x86' })
|
||||
reg.get('rootdir', (err, item) => {
|
||||
if (err || !item) {
|
||||
return resolve(null)
|
||||
}
|
||||
resolve(item.value)
|
||||
})
|
||||
})
|
||||
let cygwinPath = await Registry.get('HKLM\\Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -1,14 +1,10 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
let Registry = null
|
||||
try {
|
||||
Registry = require('winreg')
|
||||
} catch (_) { } // tslint:disable-line no-empty
|
||||
|
||||
@Injectable()
|
||||
export class Cygwin64ShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
@@ -22,15 +18,7 @@ export class Cygwin64ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = await new Promise<string>(resolve => {
|
||||
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x64' })
|
||||
reg.get('rootdir', (err, item) => {
|
||||
if (err || !item) {
|
||||
return resolve(null)
|
||||
}
|
||||
resolve(item.value)
|
||||
})
|
||||
})
|
||||
let cygwinPath = await Registry.get('HKLM\\Software\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -1,14 +1,10 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
let Registry = null
|
||||
try {
|
||||
Registry = require('winreg')
|
||||
} catch (_) { } // tslint:disable-line no-empty
|
||||
|
||||
@Injectable()
|
||||
export class GitBashShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
@@ -22,16 +18,7 @@ export class GitBashShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let gitBashPath = await new Promise<string>(resolve => {
|
||||
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' })
|
||||
reg.get('InstallPath', (err, item) => {
|
||||
if (err || !item) {
|
||||
resolve(null)
|
||||
return
|
||||
}
|
||||
resolve(item.value)
|
||||
})
|
||||
})
|
||||
let gitBashPath = await Registry.get('HKLM\\Software\\GitForWindows', 'InstallPath')
|
||||
|
||||
if (!gitBashPath) {
|
||||
gitBashPath = await new Promise<string>(resolve => {
|
||||
|
@@ -1,13 +1,8 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
let Registry = null
|
||||
try {
|
||||
Registry = require('winreg')
|
||||
} catch (_) { } // tslint:disable-line no-empty
|
||||
|
||||
@Injectable()
|
||||
export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
constructor (
|
||||
@@ -21,15 +16,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let pwshPath = await new Promise<string>(resolve => {
|
||||
let reg = new Registry({ hive: Registry.HKLM, key: '\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', arch: 'x64' })
|
||||
reg.get('', (err, item) => {
|
||||
if (err || !item) {
|
||||
return resolve(null)
|
||||
}
|
||||
resolve(item.value)
|
||||
})
|
||||
})
|
||||
let pwshPath = await Registry.get('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', '')
|
||||
|
||||
if (!pwshPath) {
|
||||
return []
|
||||
@@ -39,6 +26,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
id: 'powershell-core',
|
||||
name: 'PowerShell Core',
|
||||
command: pwshPath,
|
||||
args: ['-nologo'],
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ export class WindowsStockShellsProvider extends ShellProvider {
|
||||
id: 'powershell',
|
||||
name: 'PowerShell',
|
||||
command: 'powershell.exe',
|
||||
args: ['-nologo'],
|
||||
env: {
|
||||
TERM: 'cygwin',
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import * as fs from 'mz/fs'
|
||||
import { exec } from 'mz/child_process'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
@@ -20,9 +20,19 @@ export class WSLShellProvider extends ShellProvider {
|
||||
|
||||
const bashPath = `${process.env.windir}\\system32\\bash.exe`
|
||||
const wslPath = `${process.env.windir}\\system32\\wsl.exe`
|
||||
const wslConfigPath = `${process.env.windir}\\system32\\wslconfig.exe`
|
||||
|
||||
if (!await fs.exists(wslPath)) {
|
||||
let shells: IShell[] = [{
|
||||
id: 'wsl',
|
||||
name: 'WSL / Default distro',
|
||||
command: wslPath,
|
||||
env: {
|
||||
TERM: 'xterm-color',
|
||||
COLORTERM: 'truecolor',
|
||||
}
|
||||
}]
|
||||
|
||||
let lxss = await Registry.get('HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Lxss', true)
|
||||
if (!lxss || !lxss.$values.defaultdistribution) {
|
||||
if (await fs.exists(bashPath)) {
|
||||
return [{
|
||||
id: 'wsl',
|
||||
@@ -37,31 +47,17 @@ export class WSLShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
let lines = (await exec(`${wslConfigPath} /l`, { encoding: 'ucs2' }))[0].toString().split('\n').splice(1)
|
||||
let shells: IShell[] = [{
|
||||
id: 'wsl',
|
||||
name: 'WSL / Default distro',
|
||||
command: wslPath,
|
||||
env: {
|
||||
TERM: 'xterm-color',
|
||||
COLORTERM: 'truecolor',
|
||||
}
|
||||
}]
|
||||
|
||||
for (let line of lines) {
|
||||
line = line.trim()
|
||||
if (!line) {
|
||||
for (let child of Object.values(lxss)) {
|
||||
if (!(child as any).$values) {
|
||||
continue
|
||||
}
|
||||
if (line.endsWith('(Default)')) {
|
||||
line = line.substring(0, line.length - ' (Default)'.length)
|
||||
}
|
||||
let name = (child as any).$values.distributionname
|
||||
shells.push({
|
||||
id: `wsl-${line}`,
|
||||
name: `WSL / ${line}`,
|
||||
id: `wsl-${name}`,
|
||||
name: `WSL / ${name}`,
|
||||
command: wslPath,
|
||||
args: ['-d', line],
|
||||
args: ['-d', name],
|
||||
fsBase: (child as any).$values.basepath,
|
||||
env: {
|
||||
TERM: 'xterm-color',
|
||||
COLORTERM: 'truecolor',
|
||||
|
@@ -57,7 +57,6 @@ module.exports = {
|
||||
'node-pty-tmp',
|
||||
'mz/fs',
|
||||
'mz/child_process',
|
||||
'winreg',
|
||||
/^rxjs/,
|
||||
/^@angular/,
|
||||
/^@ng-bootstrap/,
|
||||
|
@@ -24,10 +24,6 @@
|
||||
version "1.13.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.13.0.tgz#3044381647e11ee973c5af2e925323930f691d80"
|
||||
|
||||
"@types/winreg@^1.2.30":
|
||||
version "1.2.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/winreg/-/winreg-1.2.30.tgz#91d6710e536d345b9c9b017c574cf6a8da64c518"
|
||||
|
||||
any-promise@^1.0.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
|
||||
@@ -112,6 +108,10 @@ ps-node@^0.1.6:
|
||||
dependencies:
|
||||
table-parser "^0.1.3"
|
||||
|
||||
rage-edit@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/rage-edit/-/rage-edit-1.1.0.tgz#8a5f0bf5c5ff4ab31ad086fa27a55be20fcd0357"
|
||||
|
||||
runes@^0.4.2:
|
||||
version "0.4.2"
|
||||
resolved "https://registry.yarnpkg.com/runes/-/runes-0.4.2.tgz#1ddc1ea41de769cb32fc068a64fbbc45cd21052e"
|
||||
@@ -134,10 +134,6 @@ thenify-all@^1.0.0:
|
||||
dependencies:
|
||||
any-promise "^1.0.0"
|
||||
|
||||
winreg@^1.2.3:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.4.tgz#ba065629b7a925130e15779108cf540990e98d1b"
|
||||
|
||||
xterm@^3.6.0:
|
||||
version "3.6.0"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.6.0.tgz#9b95cd23a338e5842343aec1a104f094c5153e7c"
|
||||
|
@@ -20,7 +20,8 @@
|
||||
"es5",
|
||||
"es6",
|
||||
"es7",
|
||||
"es2015"
|
||||
"es2015",
|
||||
"es2017"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -176,9 +176,9 @@
|
||||
version "10.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.7.1.tgz#b704d7c259aa40ee052eec678758a68d07132a2e"
|
||||
|
||||
"@types/node@7.0.5":
|
||||
version "7.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.5.tgz#96a0f0a618b7b606f1ec547403c00650210bfbb7"
|
||||
"@types/node@^10.11.5":
|
||||
version "10.11.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.11.5.tgz#6489ebda4452592d3fd37aefa57eedc01ed13378"
|
||||
|
||||
"@types/node@^8.0.24":
|
||||
version "8.10.26"
|
||||
|
Reference in New Issue
Block a user