Compare commits

...

26 Commits

Author SHA1 Message Date
Eugene Pankov
5bde116a4e Merge branch 'master' of github.com:Eugeny/terminus 2020-08-26 10:54:52 +02:00
Eugene Pankov
179acc1382 only use pageant as agent if it's runing - fixes #2935, fixes #2936 2020-08-26 10:54:49 +02:00
Eugene Pankov
c6d918e401 build fix 2020-08-23 16:02:56 +02:00
Eugene Pankov
62b53575ac WinSCP integration 2020-08-23 14:59:06 +02:00
Eugene Pankov
32b29a91e9 fixed random conpty freezes - fixes #2805, fixes #1583, fixes #2686, fixes #2293 2020-08-23 14:06:49 +02:00
Eugene Pankov
4346030459 lint 2020-08-16 18:52:45 +02:00
Eugene Pankov
9e8c0ccb14 restore all split tab children at once 2020-08-16 18:30:42 +02:00
Eugene Pankov
6c8d00eb16 don't mention legacy API in README 2020-08-16 18:24:55 +02:00
Eugene Pankov
b3fcfd0c8b added hotkey to focus all panes (fixes #722) 2020-08-16 18:24:47 +02:00
Eugene Pankov
4eefab5655 made warning when closing SSH tabs optional - fixes #2801 2020-08-15 21:07:35 +02:00
Eugene Pankov
2745896ec3 lint 2020-08-15 20:49:18 +02:00
Eugene Pankov
cdfaaabb70 bumped native deps 2020-08-15 20:46:50 +02:00
Eugene Pankov
60ab6ece62 fixed tab context menu for custom tab colors 2020-08-15 20:46:40 +02:00
Eugene Pankov
436318b534 Merge branch 'master' of github.com:Eugeny/terminus 2020-08-15 20:46:21 +02:00
Eugene
248f431437 Merge pull request #2648 from Eugeny/dependabot/npm_and_yarn/node-abi-2.18.0
Bump node-abi from 2.16.0 to 2.18.0
2020-08-15 20:45:56 +02:00
Eugene
7794280115 Merge pull request #2879 from Eugeny/dependabot/npm_and_yarn/typedoc-0.18.0
Bump typedoc from 0.17.7 to 0.18.0
2020-08-15 20:45:32 +02:00
Eugene Pankov
c2cc4c977f Update shellSettingsTab.component.pug 2020-08-15 19:21:12 +02:00
Eugene Pankov
f9b7f97863 handle cwd detection errors on linux 2020-08-14 12:39:14 +02:00
Eugene Pankov
59ce7eeee6 prioritize pubkey auth over password (fixes #2894) 2020-08-13 15:05:05 +02:00
Eugene Pankov
0e012a90ea Update xtermFrontend.ts 2020-08-12 21:04:42 +02:00
Eugene Pankov
6773d260cf Merge branch 'master' of github.com:Eugeny/terminus 2020-08-12 21:02:29 +02:00
Eugene
7379f6cd59 Merge pull request #2859 from 695137400/patch-1
Update xtermFrontend.ts
2020-08-12 21:02:25 +02:00
Jonathan Beverley
3aee24bdbd Re-added an option for Agent Forwarding 2020-08-12 21:00:55 +02:00
dependabot-preview[bot]
84dbfa5d6c Bump typedoc from 0.17.7 to 0.18.0
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.17.7 to 0.18.0.
- [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
- [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.17.7...v0.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-10 04:19:24 +00:00
695137400
7030f562e8 Update xtermFrontend.ts
console error
2020-08-04 18:21:26 +08:00
dependabot-preview[bot]
a5a662c05d Bump node-abi from 2.16.0 to 2.18.0
Bumps [node-abi](https://github.com/lgeiger/node-abi) from 2.16.0 to 2.18.0.
- [Release notes](https://github.com/lgeiger/node-abi/releases)
- [Commits](https://github.com/lgeiger/node-abi/compare/v2.16.0...v2.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-08 07:15:31 +00:00
25 changed files with 276 additions and 76 deletions

View File

@@ -31,7 +31,7 @@
"keytar": "^6.0.1",
"mz": "^2.7.0",
"ngx-toastr": "^12.0.1",
"node-pty": "^0.10.0-beta9",
"@terminus-term/node-pty": "0.10.0-beta9",
"npm": "6.9.0",
"path": "0.12.7",
"rxjs": "^6.5.5",
@@ -40,10 +40,10 @@
"zone.js": "^0.10.3"
},
"optionalDependencies": {
"macos-native-processlist": "^1.0.2",
"macos-native-processlist": "^2.0.0",
"serialport": "^9.0.0",
"windows-blurbehind": "^1.0.1",
"windows-native-registry": "^1.0.17",
"windows-native-registry": "^3.0.0",
"windows-process-tree": "^0.2.4"
},
"devDependencies": {

View File

@@ -108,6 +108,13 @@
dependencies:
debug "^4.1.1"
"@terminus-term/node-pty@0.10.0-beta.9":
version "0.10.0-beta9"
resolved "https://registry.yarnpkg.com/@terminus-term/node-pty/-/node-pty-0.10.0-beta9.tgz#b4caff6b069139add9be959e00b364f8fe3c620d"
integrity sha512-wnttx12b9gxP9CPB9uqBMQx/Vp4EboUDGOY3xRP0Nvhec6pSF2qFZD6bwMbNzFIopbaohluEYcbEul0jTQcdeQ==
dependencies:
nan "^2.13.2"
"@types/color-name@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
@@ -1763,12 +1770,12 @@ lru-cache@^5.1.1:
dependencies:
yallist "^3.0.2"
macos-native-processlist@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/macos-native-processlist/-/macos-native-processlist-1.0.2.tgz#78767e4fdea3eea782bbf063dac8c1e2420786dc"
integrity sha512-ShX+vFA44eaJ9/JCPTrhL0j4KLVKrYjeTQCFuR0kx7qWxETBDbFX8I3WKKXeALMtWSD+F4TDpza2mwCcE2tWAw==
macos-native-processlist@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/macos-native-processlist/-/macos-native-processlist-2.0.0.tgz#135e24612c4b0f1f16a51526bd040d5026143d38"
integrity sha512-ciW1n2jL+9f7+9xijMMVmVzRbpVlKjzMFmgpNricm5QKfkUTMEa1suR0pc9pQRrLea4sJtbLo0u+izzHDvkpIA==
dependencies:
nan "^2.13.2"
node-addon-api "3.0.0"
make-dir@^1.0.0:
version "1.3.0"
@@ -1924,7 +1931,7 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"
nan@^2.13.2, nan@^2.14.0, nan@^2.14.1:
nan@^2.13.2, nan@^2.14.1:
version "2.14.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
@@ -1946,7 +1953,7 @@ node-abi@^2.18.0, node-abi@^2.7.0:
dependencies:
semver "^5.4.1"
node-addon-api@^3.0.0:
node-addon-api@3.0.0, node-addon-api@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.0.0.tgz#812446a1001a54f71663bed188314bba07e09247"
integrity sha512-sSHCgWfJ+Lui/u+0msF3oyCgvdkhxDbkCS6Q8uiJquzOimkJBvX6hl5aSSA7DR1XbMpdM8r7phjcF63sF4rkKg==
@@ -1995,13 +2002,6 @@ node-gyp@^4.0.0:
tar "^4.4.8"
which "1"
node-pty@^0.10.0-beta9:
version "0.10.0-beta9"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.10.0-beta9.tgz#e5a795f9b53948346803cb71bac4ffc02e7909f0"
integrity sha512-Qm6uSH30FUcAhJ9s76C+lgvTsOW2cHUbkIGjCdOVCL0c7S4DxsmKBRgjcr+guUK9d9KwfuZHeSjXYWjpJFPe4w==
dependencies:
nan "^2.14.0"
noop-logger@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2"
@@ -3412,12 +3412,12 @@ windows-blurbehind@^1.0.1:
resolved "https://registry.yarnpkg.com/windows-blurbehind/-/windows-blurbehind-1.0.1.tgz#ff098713873304e38330b2c54cc41bb369b587b9"
integrity sha512-1HzHfCiM1ayrbACJu5qE9zELV24uX/tINT6kxaZwLY3rtQAoeav6x9z7LFHWoLaGDN/sYbnK+9Vk0cz7fsk5HQ==
windows-native-registry@^1.0.17:
version "1.0.17"
resolved "https://registry.yarnpkg.com/windows-native-registry/-/windows-native-registry-1.0.17.tgz#d8cce48b364703a55c226690431b325114405022"
integrity sha512-u9Fp9TyDo5dvhlW6hYBOdHPETtAahXKxo3jeW5EXwNK7qa+nSNopQycN1drtBVWe3jpJXvyKpt9zrjiDd+u4JQ==
windows-native-registry@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/windows-native-registry/-/windows-native-registry-3.0.0.tgz#82e715df7a59d5054c768547d81e0bfc81a59d2e"
integrity sha512-Mz/9a23UivwPc23DsTOL/ZCp/XXogT+6h/khk1psOfDDusXqpomBdxNdsBBE/BvIgOExjGom0XPOfEPiDnHy7A==
dependencies:
nan "^2.14.0"
node-addon-api "^3.0.0"
windows-process-tree@^0.2.4:
version "0.2.4"

View File

@@ -27,7 +27,7 @@
"graceful-fs": "^4.2.4",
"html-loader": "0.5.5",
"json-loader": "0.5.7",
"node-abi": "^2.16.0",
"node-abi": "^2.18.0",
"node-gyp": "^7.0.0",
"node-sass": "^4.14.1",
"npmlog": "4.1.2",
@@ -46,7 +46,7 @@
"svg-inline-loader": "^0.8.0",
"to-string-loader": "1.1.6",
"tslib": "^2.0.0",
"typedoc": "^0.17.7",
"typedoc": "^0.18.0",
"typescript": "^3.9.3",
"url-loader": "^3.0.0",
"val-loader": "2.1.1",

View File

@@ -157,6 +157,10 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
/** @hidden */
_spanners: SplitSpannerInfo[] = []
/** @hidden */
_allFocusMode = false
/** @hidden */
private focusedTab: BaseTabComponent
private maximizedTab: BaseTabComponent|null = null
private hotkeysSubscription: Subscription
@@ -254,12 +258,13 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
if (this._recoveredState) {
await this.recoverContainer(this.root, this._recoveredState)
this.layout()
setImmediate(() => {
setTimeout(() => {
if (this.hasFocus) {
this.getAllTabs().forEach(x => x.emitFocused())
this.focusAnyIn(this.root)
for (const tab of this.getAllTabs()) {
this.focus(tab)
}
}
})
}, 100)
}
this.initialized.next()
this.initialized.complete()
@@ -480,6 +485,12 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
}
}
layout (): void {
this.root.normalize()
this._spanners = []
this.layoutInternal(this.root, 0, 0, 100, 100)
}
private attachTabView (tab: BaseTabComponent) {
const ref = this.viewContainer.insert(tab.hostView) as EmbeddedViewRef<any> // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
this.viewRefs.set(tab, ref)
@@ -505,12 +516,6 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
}
}
private layout () {
this.root.normalize()
this._spanners = []
this.layoutInternal(this.root, 0, 0, 100, 100)
}
private layoutInternal (root: SplitContainer, x: number, y: number, w: number, h: number) {
const size = root.orientation === 'v' ? h : w
const sizes = root.ratios.map(x => x * size)
@@ -535,7 +540,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
element.classList.toggle('child', true)
element.classList.toggle('maximized', child === this.maximizedTab)
element.classList.toggle('minimized', this.maximizedTab && child !== this.maximizedTab)
element.classList.toggle('focused', child === this.focusedTab)
element.classList.toggle('focused', this._allFocusMode || child === this.focusedTab)
element.style.left = `${childX}%`
element.style.top = `${childY}%`
element.style.width = `${childW}%`

View File

@@ -120,7 +120,7 @@ export class CommonOptionsContextMenu extends TabContextMenuItemProvider {
},
{
label: 'Color',
sublabel: COLORS.find(x => x.value === tab.color)!.name,
sublabel: COLORS.find(x => x.value === tab.color)?.name,
submenu: COLORS.map(color => ({
label: color.name,
type: 'radio',

View File

@@ -37,7 +37,8 @@ export interface SSHConnection {
skipBanner?: boolean
disableDynamicTitle?: boolean
jumpHost?: string
agentForward?: boolean
warnOnClose?: boolean
algorithms?: {[t: string]: string[]}
}

View File

@@ -111,6 +111,11 @@
.title X11 forwarding
toggle([(ngModel)]='connection.x11')
.form-line
.header
.title Agent Forwarding
toggle([(ngModel)]='connection.agentForward')
.form-line
.header
.title Tab color

View File

@@ -1,7 +1,7 @@
h3 Connections
.list-group.list-group-flush.mt-3.mb-3
ng-container(*ngFor='let group of childGroups')
ng-container(*ngFor='let group of childGroups')
.list-group-item.list-group-item-action.d-flex.align-items-center(
(click)='groupCollapsed[group.name] = !groupCollapsed[group.name]'
)
@@ -22,7 +22,28 @@ h3 Connections
.text-muted {{connection.host}}
button.btn.btn-outline-danger.ml-1((click)='$event.stopPropagation(); deleteConnection(connection)')
i.fas.fa-trash
button.btn.btn-primary((click)='createConnection()')
i.fas.fa-fw.fa-plus
span.ml-2 Add connection
h3.mt-5 Options
.form-line
.header
.title Warn when closing active connections
toggle(
[(ngModel)]='config.store.ssh.warnOnClose',
(ngModelChange)='config.save()',
)
.form-line
.header
.title WinSCP path
.descriptions When WinSCP is detected, you can launch an SCP session from the context menu.
input.form-control(
type='text',
placeholder='Auto-detect',
[(ngModel)]='config.store.ssh.winSCPPath',
(ngModelChange)='config.save()',
)

View File

@@ -163,6 +163,9 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
if (!this.session?.open) {
return true
}
if (!(this.connection.warnOnClose ?? this.config.store.ssh.warnOnClose)) {
return true
}
return (await this.electron.showMessageBox(
this.hostApp.getWindow(),
{

View File

@@ -6,8 +6,8 @@ export class SSHConfigProvider extends ConfigProvider {
ssh: {
connections: [],
recentConnections: [],
options: {
},
warnOnClose: false,
winSCPPath: null,
},
hotkeys: {
ssh: [

View File

@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common'
import { FormsModule } from '@angular/forms'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { ToastrModule } from 'ngx-toastr'
import TerminusCoreModule, { ToolbarButtonProvider, ConfigProvider, TabRecoveryProvider, HotkeyProvider } from 'terminus-core'
import TerminusCoreModule, { ToolbarButtonProvider, ConfigProvider, TabRecoveryProvider, HotkeyProvider, TabContextMenuItemProvider } from 'terminus-core'
import { SettingsTabProvider } from 'terminus-settings'
import TerminusTerminalModule from 'terminus-terminal'
@@ -18,6 +18,7 @@ import { SSHConfigProvider } from './config'
import { SSHSettingsTabProvider } from './settings'
import { RecoveryProvider } from './recoveryProvider'
import { SSHHotkeyProvider } from './hotkeys'
import { WinSCPContextMenu } from './winSCPIntegration'
/** @hidden */
@NgModule({
@@ -35,6 +36,7 @@ import { SSHHotkeyProvider } from './hotkeys'
{ provide: SettingsTabProvider, useClass: SSHSettingsTabProvider, multi: true },
{ provide: TabRecoveryProvider, useClass: RecoveryProvider, multi: true },
{ provide: HotkeyProvider, useClass: SSHHotkeyProvider, multi: true },
{ provide: TabContextMenuItemProvider, useClass: WinSCPContextMenu, multi: true },
],
entryComponents: [
EditConnectionModalComponent,

View File

@@ -18,6 +18,10 @@ import { SSHTabComponent } from '../components/sshTab.component'
const WINDOWS_OPENSSH_AGENT_PIPE = '\\\\.\\pipe\\openssh-ssh-agent'
try {
var windowsProcessTreeNative = require('windows-process-tree/build/Release/windows_process_tree.node') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
} catch { }
@Injectable({ providedIn: 'root' })
export class SSHService {
private logger: Logger
@@ -193,16 +197,20 @@ export class SSHService {
if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) {
agent = WINDOWS_OPENSSH_AGENT_PIPE
} else {
agent = 'pageant'
const pageantRunning = new Promise<boolean>(resolve => {
windowsProcessTreeNative.getProcessList(list => { // eslint-disable-line block-scoped-var
resolve(list.some(x => x.name === 'pageant.exe'))
}, 0)
})
if (pageantRunning) {
agent = 'pageant'
}
}
} else {
agent = process.env.SSH_AUTH_SOCK as string
}
const authMethodsLeft = ['none']
if (!session.connection.auth || session.connection.auth === 'password') {
authMethodsLeft.push('password')
}
if (!session.connection.auth || session.connection.auth === 'publicKey') {
if (!privateKey) {
log('\r\nPrivate key auth selected, but no key is loaded\r\n')
@@ -217,6 +225,9 @@ export class SSHService {
authMethodsLeft.push('agent')
}
}
if (!session.connection.auth || session.connection.auth === 'password') {
authMethodsLeft.push('password')
}
if (!session.connection.auth || session.connection.auth === 'keyboardInteractive') {
authMethodsLeft.push('keyboard-interactive')
}
@@ -231,7 +242,7 @@ export class SSHService {
privateKey: privateKey || undefined,
tryKeyboard: true,
agent: agent || undefined,
agentForward: (!session.connection.auth || session.connection.auth === 'agent') && !!agent,
agentForward: session.connection.agentForward && !!agent,
keepaliveInterval: session.connection.keepaliveInterval,
keepaliveCountMax: session.connection.keepaliveCountMax,
readyTimeout: session.connection.readyTimeout,

View File

@@ -0,0 +1,85 @@
import { execFile } from 'child_process'
import { Injectable } from '@angular/core'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, HostAppService, Platform } from 'terminus-core'
import { SSHTabComponent } from './components/sshTab.component'
import { PasswordStorageService } from './services/passwordStorage.service'
import { SSHConnection } from './api'
/* eslint-disable block-scoped-var */
try {
var wnr = require('windows-native-registry') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
} catch { }
/** @hidden */
@Injectable()
export class WinSCPContextMenu extends TabContextMenuItemProvider {
weight = 10
private detectedPath?: string
constructor (
private hostApp: HostAppService,
private config: ConfigService,
private passwordStorage: PasswordStorageService,
) {
super()
if (hostApp.platform !== Platform.Windows) {
return
}
const key = wnr.getRegistryKey(wnr.HK.CR, 'WinSCP.Url\\DefaultIcon')
if (key?.['']) {
this.detectedPath = key[''].value?.split(',')[0]
this.detectedPath = this.detectedPath?.substring(1, this.detectedPath.length - 1)
}
}
async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise<Electron.MenuItemConstructorOptions[]> {
if (this.hostApp.platform !== Platform.Windows || tabHeader) {
return []
}
if (!this.getPath()) {
return []
}
if (!(tab instanceof SSHTabComponent)) {
return []
}
return [
{
label: 'Launch WinSCP',
click: (): void => {
this.launchWinSCP(tab.connection)
},
},
]
}
getPath (): string|undefined {
return this.detectedPath ?? this.config.store.ssh.winSCPPath
}
async getURI (connection: SSHConnection): Promise<string> {
let uri = `scp://${connection.user}`
const password = await this.passwordStorage.loadPassword(connection)
if (password) {
uri += ':' + encodeURIComponent(password)
}
uri += `@${connection.host}:${connection.port}/`
return uri
}
async launchWinSCP (connection: SSHConnection): Promise<void> {
const path = this.getPath()
if (!path) {
return
}
let args = [await this.getURI(connection)]
if ((!connection.auth || connection.auth === 'publicKey') && connection.privateKey) {
args.push('/privatekey')
args.push(connection.privateKey)
}
execFile(path, args)
}
}

View File

@@ -45,10 +45,12 @@ module.exports = {
],
},
externals: [
'child_process',
'fs',
'keytar',
'path',
'ngx-toastr',
'windows-native-registry',
'windows-process-tree/build/Release/windows_process_tree.node',
/^rxjs/,
/^@angular/,

View File

@@ -9,7 +9,7 @@ Terminus Terminal Plugin
Using the API:
```ts
import { TerminalContextMenuItemProvider } from 'terminus-terminal'
import { ShellProvider } from 'terminus-terminal'
```
Exporting your subclasses:
@@ -19,7 +19,7 @@ Exporting your subclasses:
...
providers: [
...
{ provide: TerminalContextMenuItemProvider, useClass: MyContextMenu, multi: true },
{ provide: ShellProvider, useClass: MyShellPlugin, multi: true },
...
]
})

View File

@@ -4,7 +4,7 @@ import { ToastrService } from 'ngx-toastr'
import colors from 'ansi-colors'
import { NgZone, OnInit, OnDestroy, Injector, ViewChild, HostBinding, Input, ElementRef, InjectFlags } from '@angular/core'
import { trigger, transition, style, animate, AnimationTriggerMetadata } from '@angular/animations'
import { AppService, ConfigService, BaseTabComponent, ElectronService, HostAppService, HotkeysService, Platform, LogService, Logger, TabContextMenuItemProvider } from 'terminus-core'
import { AppService, ConfigService, BaseTabComponent, ElectronService, HostAppService, HotkeysService, Platform, LogService, Logger, TabContextMenuItemProvider, SplitTabComponent } from 'terminus-core'
import { BaseSession, SessionsService } from '../services/sessions.service'
import { TerminalFrontendService } from '../services/terminalFrontend.service'
@@ -92,6 +92,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
private hotkeysSubscription: Subscription
private bellPlayer: HTMLAudioElement
private termContainerSubscriptions: Subscription[] = []
private allFocusModeSubscription: Subscription|null = null
get input$ (): Observable<Buffer> { return this.frontend.input$ }
get output$ (): Observable<string> { return this.output }
@@ -172,6 +173,9 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
this.element.nativeElement.querySelector('.search-input').focus()
})
break
case 'pane-focus-all':
this.focusAllPanes()
break
}
})
this.bellPlayer = document.createElement('audio')
@@ -255,6 +259,10 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
})
this.frontend.focus()
this.blurred$.subscribe(() => {
this.cancelFocusAllPanes()
})
}
async buildContextMenu (): Promise<Electron.MenuItemConstructorOptions[]> {
@@ -366,6 +374,35 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
this.frontend.setZoom(this.zoom)
}
focusAllPanes (): void {
if (this.allFocusModeSubscription) {
return
}
if (this.parent instanceof SplitTabComponent) {
this.parent._allFocusMode = true
this.parent.layout()
this.allFocusModeSubscription = this.frontend.input$.subscribe(data => {
for (const tab of (this.parent as SplitTabComponent).getAllTabs()) {
if (tab !== this && tab instanceof BaseTerminalTabComponent) {
tab.sendInput(data)
}
}
})
}
}
cancelFocusAllPanes (): void {
if (!this.allFocusModeSubscription) {
return
}
if (this.parent instanceof SplitTabComponent) {
this.allFocusModeSubscription?.unsubscribe?.()
this.allFocusModeSubscription = null
this.parent._allFocusMode = false
this.parent.layout()
}
}
/** @hidden */
ngOnDestroy (): void {
this.frontend.detach(this.content.nativeElement)

View File

@@ -27,6 +27,9 @@ h3.mb-3 Appearance
(ngModelChange)='config.save()',
)
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.ligatures && config.store.terminal.frontend == "xterm-webgl"') Ligatures are not supported by the WebGL frontend
color-scheme-preview([scheme]='config.store.terminal.colorScheme', [fontPreview]='true')
.form-line

View File

@@ -28,8 +28,8 @@ h3.mb-3 Shell
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.useConPTY && isConPTYAvailable && !isConPTYStable')
.mr-auto Windows 10 build 18309 or above is recommended for ConPTY
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.profile.startsWith("WSL") && (config.store.terminal.frontend != "hterm" || !config.store.terminal.useConPTY)')
.mr-auto WSL terminal only supports TrueColor with ConPTY and the hterm frontend
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.profile.startsWith("WSL") && (!config.store.terminal.useConPTY)')
.mr-auto WSL terminal only supports TrueColor with ConPTY
.form-line(*ngIf='config.store.terminal.profile == "custom-shell"')
.header

View File

@@ -109,6 +109,9 @@ export class TerminalConfigProvider extends ConfigProvider {
search: [
'⌘-F',
],
'pane-focus-all': [
'⌘-Shift-I',
],
},
},
[Platform.Windows]: {
@@ -152,6 +155,9 @@ export class TerminalConfigProvider extends ConfigProvider {
search: [
'Ctrl-Shift-F',
],
'pane-focus-all': [
'Ctrl-Shift-I',
],
},
},
[Platform.Linux]: {
@@ -192,6 +198,9 @@ export class TerminalConfigProvider extends ConfigProvider {
search: [
'Ctrl-Shift-F',
],
'pane-focus-all': [
'Ctrl-Shift-I',
],
},
},
}

View File

@@ -110,7 +110,9 @@ export class XTermFrontend extends Frontend {
let cols = Math.floor(l / actualCellWidth)
let rows = Math.floor(i / actualCellHeight)
this.xterm.resize(cols, rows)
if (!isNaN(cols) && !isNaN(rows)) {
this.xterm.resize(cols, rows)
}
}
} catch (e) {
// tends to throw when element wasn't shown yet

View File

@@ -66,6 +66,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
id: 'search',
name: 'Search',
},
{
id: 'pane-focus-all',
name: 'Focus all panes at once',
},
]
constructor (

View File

@@ -1,7 +1,7 @@
import * as psNode from 'ps-node'
import * as fs from 'mz/fs'
import * as os from 'os'
import * as nodePTY from 'node-pty'
import * as nodePTY from '@terminus-term/node-pty'
import { Observable, Subject } from 'rxjs'
import { first } from 'rxjs/operators'
@@ -281,7 +281,8 @@ export class Session extends BaseSession {
}
if (process.platform === 'linux') {
try {
return fs.readlink(`/proc/${this.truePID}/cwd`)
const cwd = await fs.readlink(`/proc/${this.truePID}/cwd`)
return cwd
} catch (exc) {
console.error(exc)
return null

View File

@@ -1,6 +1,6 @@
import { Injectable, NgZone, Optional, Inject } from '@angular/core'
import { ToastrService } from 'ngx-toastr'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent } from 'terminus-core'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, SplitTabComponent } from 'terminus-core'
import { TerminalTabComponent } from './components/terminalTab.component'
import { UACService } from './services/uac.service'
import { TerminalService } from './services/terminal.service'
@@ -113,6 +113,15 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
})
}
if (tab instanceof BaseTerminalTabComponent && tab.parent instanceof SplitTabComponent && tab.parent.getAllTabs().length > 1) {
items.push({
label: 'Focus all panes',
click: () => this.zone.run(() => {
tab.focusAllPanes()
}),
})
}
return items
}
}

View File

@@ -65,7 +65,7 @@ module.exports = {
'path',
'macos-native-processlist',
'windows-native-registry',
'node-pty',
'@terminus-term/node-pty',
'windows-process-tree',
'os',
/^rxjs/,

View File

@@ -4197,10 +4197,10 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
marked@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/marked/-/marked-1.0.0.tgz#d35784245a04871e5988a491e28867362e941693"
integrity sha512-Wo+L1pWTVibfrSr+TTtMuiMfNzmZWiOPeO7rZsQUY5bgsxpHesBEcIWJloWVTFnrMXnf/TL30eTFSGJddmQAng==
marked@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/marked/-/marked-1.1.1.tgz#e5d61b69842210d5df57b05856e0c91572703e6a"
integrity sha512-mJzT8D2yPxoPh7h0UXkB+dBj4FykPJ2OIfxAWeIHrvoHDkFxukV/29QxoFQoPM6RLEwhIFdJpmKBlqVM3s2ZIw==
matcher@^2.0.0:
version "2.0.0"
@@ -4503,10 +4503,10 @@ no-case@^2.2.0:
dependencies:
lower-case "^1.1.1"
node-abi@^2.11.0, node-abi@^2.14.0, node-abi@^2.16.0:
version "2.16.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.16.0.tgz#7df94e9c0a7a189f4197ab84bac8089ef5894992"
integrity sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==
node-abi@^2.11.0, node-abi@^2.14.0, node-abi@^2.18.0:
version "2.18.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.18.0.tgz#1f5486cfd7d38bd4f5392fa44a4ad4d9a0dffbf4"
integrity sha512-yi05ZoiuNNEbyT/xXfSySZE+yVnQW6fxPZuFbLyS1s6b5Kw3HzV2PHOM4XR+nsjzkHxByK+2Wg+yCQbe35l8dw==
dependencies:
semver "^5.4.1"
@@ -7027,28 +7027,28 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typedoc-default-themes@^0.10.1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.10.1.tgz#eb27b7d689457c7ec843e47ec0d3e500581296a7"
integrity sha512-SuqAQI0CkwhqSJ2kaVTgl37cWs733uy9UGUqwtcds8pkFK8oRF4rZmCq+FXTGIb9hIUOu40rf5Kojg0Ha6akeg==
typedoc-default-themes@^0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.10.2.tgz#743380a80afe62c5ef92ca1bd4abe2ac596be4d2"
integrity sha512-zo09yRj+xwLFE3hyhJeVHWRSPuKEIAsFK5r2u47KL/HBKqpwdUSanoaz5L34IKiSATFrjG5ywmIu98hPVMfxZg==
dependencies:
lunr "^2.3.8"
typedoc@^0.17.7:
version "0.17.7"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.17.7.tgz#70797401140403a5f91589ed3f4f24c03841bf7a"
integrity sha512-PEnzjwQAGjb0O8a6VDE0lxyLAadqNujN5LltsTUhZETolRMiIJv6Ox+Toa8h0XhKHqAOh8MOmB0eBVcWz6nuAw==
typedoc@^0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.18.0.tgz#8bf53ddd7df5b8966b52c946929a09549d78682b"
integrity sha512-UgDQwapCGQCCdYhEQzQ+kGutmcedklilgUGf62Vw6RdI29u6FcfAXFQfRTiJEbf16aK3YnkB20ctQK1JusCRbA==
dependencies:
fs-extra "^8.1.0"
fs-extra "^9.0.1"
handlebars "^4.7.6"
highlight.js "^10.0.0"
lodash "^4.17.15"
lunr "^2.3.8"
marked "1.0.0"
marked "^1.1.1"
minimatch "^3.0.0"
progress "^2.0.3"
shelljs "^0.8.4"
typedoc-default-themes "^0.10.1"
typedoc-default-themes "^0.10.2"
typescript@^3.9.3:
version "3.9.3"