mirror of
https://github.com/Eugeny/tabby.git
synced 2025-08-16 06:11:53 +00:00
Compare commits
58 Commits
dependabot
...
revert-861
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6d3a71840b | ||
![]() |
a7ca0fb1a3 | ||
![]() |
a07e7ddf16 | ||
![]() |
86948d1eeb | ||
![]() |
75a3439f4d | ||
![]() |
1b1c0688a0 | ||
![]() |
7b9af38701 | ||
![]() |
c28a087b4c | ||
![]() |
61f6399926 | ||
![]() |
629c17afc5 | ||
![]() |
f2871decda | ||
![]() |
130d22a00c | ||
![]() |
d9e659e8a9 | ||
![]() |
556299ce74 | ||
![]() |
eeca05aded | ||
![]() |
4f06e5392a | ||
![]() |
5232e08b3e | ||
![]() |
2fb7d120cc | ||
![]() |
4b9769b5f9 | ||
![]() |
89b48f10ea | ||
![]() |
d6d6ec39c8 | ||
![]() |
1579356d54 | ||
![]() |
e771570934 | ||
![]() |
b0fc7710c7 | ||
![]() |
f60966b689 | ||
![]() |
c8ef4543c3 | ||
![]() |
f56c1bbfd4 | ||
![]() |
4a23aceb2d | ||
![]() |
cbabc1c829 | ||
![]() |
b1ac07e16e | ||
![]() |
2f82fb06b1 | ||
![]() |
75a3e89b1f | ||
![]() |
d10926bf46 | ||
![]() |
a53feb3215 | ||
![]() |
018a9940d1 | ||
![]() |
9a3f1a68c6 | ||
![]() |
23fba79173 | ||
![]() |
549954d49f | ||
![]() |
816468214f | ||
![]() |
f6d406e0da | ||
![]() |
6bbe3b82dd | ||
![]() |
07497ac869 | ||
![]() |
3dc85936d9 | ||
![]() |
b5a6606895 | ||
![]() |
ef195c406b | ||
![]() |
5d2e4582f1 | ||
![]() |
682f1a9b9e | ||
![]() |
f373cd958c | ||
![]() |
40c5659315 | ||
![]() |
a8b84d158f | ||
![]() |
4d9486e6c1 | ||
![]() |
60a63d9c65 | ||
![]() |
5e673106e9 | ||
![]() |
27c8b920ea | ||
![]() |
bc8ac12aef | ||
![]() |
7f2340e701 | ||
![]() |
b0350b6a35 | ||
![]() |
cea5cc73ff |
@@ -37,7 +37,7 @@
|
||||
"core-js": "^3.31.0",
|
||||
"core-js-pure": "^3.21.1",
|
||||
"cross-env": "7.0.3",
|
||||
"css-loader": "^6.8.1",
|
||||
"css-loader": "^6.7.3",
|
||||
"deep-equal": "2.0.5",
|
||||
"electron": "22.3.1",
|
||||
"electron-builder": "^24.0.0-alpha.1",
|
||||
|
@@ -23,6 +23,7 @@ hotkeys:
|
||||
duplicate-tab: []
|
||||
restart-tab: []
|
||||
reconnect-tab: []
|
||||
disconnect-tab: []
|
||||
explode-tab:
|
||||
- 'Ctrl-Shift-.'
|
||||
combine-tabs:
|
||||
|
@@ -40,6 +40,7 @@ hotkeys:
|
||||
duplicate-tab: []
|
||||
restart-tab: []
|
||||
reconnect-tab: []
|
||||
disconnect-tab: []
|
||||
explode-tab:
|
||||
- '⌘-Shift-.'
|
||||
combine-tabs:
|
||||
|
@@ -24,6 +24,7 @@ hotkeys:
|
||||
duplicate-tab: []
|
||||
restart-tab: []
|
||||
reconnect-tab: []
|
||||
disconnect-tab: []
|
||||
explode-tab:
|
||||
- 'Ctrl-Shift-.'
|
||||
combine-tabs:
|
||||
|
@@ -59,7 +59,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
|
||||
|
||||
async newProfile (base?: PartialProfile<Profile>): Promise<void> {
|
||||
if (!base) {
|
||||
const profiles = [...this.templateProfiles, ...this.builtinProfiles, ...this.profiles]
|
||||
let profiles = [...this.templateProfiles, ...this.builtinProfiles, ...this.profiles]
|
||||
profiles = profiles.filter(x => !this.isProfileBlacklisted(x))
|
||||
profiles.sort((a, b) => (a.weight ?? 0) - (b.weight ?? 0))
|
||||
base = await this.selector.show(
|
||||
this.translate.instant('Select a base profile to use as a template'),
|
||||
|
@@ -9,7 +9,7 @@ import { SettingsTabProvider } from '../api'
|
||||
:host {
|
||||
display: block;
|
||||
padding-bottom: 20px;
|
||||
max-width: 500px;
|
||||
max-width: 600px;
|
||||
}
|
||||
`],
|
||||
})
|
||||
|
@@ -772,10 +772,7 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
})
|
||||
|
||||
this.attachSessionHandler(this.session.closed$, () => {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
if (destroyOnSessionClose || behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()) {
|
||||
this.destroy()
|
||||
}
|
||||
this.onSessionClosed(destroyOnSessionClose)
|
||||
})
|
||||
|
||||
this.attachSessionHandler(this.session.destroyed$, () => {
|
||||
@@ -788,6 +785,23 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when session is closed.
|
||||
*/
|
||||
protected onSessionClosed (destroyOnSessionClose = false): void {
|
||||
if (destroyOnSessionClose || this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
const behavior = this.profile.behaviorOnSessionEnd
|
||||
return behavior === 'close' || behavior === 'auto' && this.isSessionExplicitlyTerminated()
|
||||
}
|
||||
|
||||
/**
|
||||
* Method called when session is destroyed. Set the session to null
|
||||
*/
|
||||
|
@@ -16,13 +16,25 @@ import { GetRecoveryTokenOptions, RecoveryToken } from 'tabby-core'
|
||||
export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProfile> extends BaseTerminalTabComponent<P> {
|
||||
|
||||
protected reconnectOffered = false
|
||||
protected isDisconnectedByHand = false
|
||||
|
||||
constructor (protected injector: Injector) {
|
||||
super(injector)
|
||||
|
||||
this.subscribeUntilDestroyed(this.hotkeys.hotkey$, hotkey => {
|
||||
if (this.hasFocus && hotkey === 'reconnect-tab') {
|
||||
this.reconnect()
|
||||
if (!this.hasFocus) {
|
||||
return
|
||||
}
|
||||
|
||||
switch (hotkey) {
|
||||
case 'reconnect-tab':
|
||||
this.reconnect()
|
||||
this.notifications.notice(this.translate.instant('Reconnect'))
|
||||
break
|
||||
case 'disconnect-tab':
|
||||
this.disconnect()
|
||||
this.notifications.notice(this.translate.instant('Disconnect'))
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -44,6 +56,7 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
*/
|
||||
async initializeSession (): Promise<void> {
|
||||
this.reconnectOffered = false
|
||||
this.isDisconnectedByHand = false
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,9 +66,9 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
super.onSessionDestroyed()
|
||||
|
||||
if (this.frontend) {
|
||||
if (this.profile.behaviorOnSessionEnd === 'reconnect') {
|
||||
if (this.profile.behaviorOnSessionEnd === 'reconnect' && !this.isDisconnectedByHand) {
|
||||
this.reconnect()
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || this.profile.behaviorOnSessionEnd === 'auto' && !this.isSessionExplicitlyTerminated()) {
|
||||
} else if (this.profile.behaviorOnSessionEnd === 'keep' || !this.shouldTabBeDestroyedOnSessionClose()) {
|
||||
this.offerReconnection()
|
||||
}
|
||||
}
|
||||
@@ -77,6 +90,16 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if tab should be destroyed on session closed.
|
||||
*/
|
||||
protected shouldTabBeDestroyedOnSessionClose (): boolean {
|
||||
if (this.isDisconnectedByHand) {
|
||||
return false
|
||||
}
|
||||
return super.shouldTabBeDestroyedOnSessionClose()
|
||||
}
|
||||
|
||||
async getRecoveryToken (options?: GetRecoveryTokenOptions): Promise<RecoveryToken> {
|
||||
return {
|
||||
type: `app:${this.profile.type}-tab`,
|
||||
@@ -85,6 +108,11 @@ export abstract class ConnectableTerminalTabComponent<P extends BaseTerminalProf
|
||||
}
|
||||
}
|
||||
|
||||
async disconnect (): Promise<void> {
|
||||
this.isDisconnectedByHand = true
|
||||
await this.session?.destroy()
|
||||
}
|
||||
|
||||
async reconnect (): Promise<void> {
|
||||
this.session?.destroy()
|
||||
await this.initializeSession()
|
||||
|
@@ -101,6 +101,10 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
|
||||
id: 'reconnect-tab',
|
||||
name: this.translate.instant('Reconnect current tab (Serial/Telnet/SSH)'),
|
||||
},
|
||||
{
|
||||
id: 'disconnect-tab',
|
||||
name: this.translate.instant('Disconnect current tab (Serial/Telnet/SSH)'),
|
||||
},
|
||||
]
|
||||
|
||||
constructor (private translate: TranslateService) { super() }
|
||||
|
@@ -99,6 +99,15 @@ export class ReconnectContextMenu extends TabContextMenuItemProvider {
|
||||
async getItems (tab: BaseTabComponent): Promise<MenuItemOptions[]> {
|
||||
if (tab instanceof ConnectableTerminalTabComponent) {
|
||||
return [
|
||||
{
|
||||
label: this.translate.instant('Disconnect'),
|
||||
click: (): void => {
|
||||
setTimeout(() => {
|
||||
tab.disconnect()
|
||||
this.notifications.notice(this.translate.instant('Disconnect'))
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
label: this.translate.instant('Reconnect'),
|
||||
click: (): void => {
|
||||
|
45
yarn.lock
45
yarn.lock
@@ -2587,15 +2587,15 @@ crypto-random-string@^1.0.0:
|
||||
resolved "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz"
|
||||
integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=
|
||||
|
||||
css-loader@^6.8.1:
|
||||
version "6.8.1"
|
||||
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.8.1.tgz#0f8f52699f60f5e679eab4ec0fcd68b8e8a50a88"
|
||||
integrity sha512-xDAXtEVGlD0gJ07iclwWVkLoZOpEvAWaSyf6W18S2pOC//K8+qUDIx8IIT3D+HjnmkJPQeesOPv5aiUaJsCM2g==
|
||||
css-loader@^6.7.3:
|
||||
version "6.7.3"
|
||||
resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.7.3.tgz#1e8799f3ccc5874fdd55461af51137fcc5befbcd"
|
||||
integrity sha512-qhOH1KlBMnZP8FzRO6YCH9UHXQhVMcEGLyNdb7Hv2cpcmJbW0YrddO+tG1ab5nT41KpHIYGsbeHqxB9xPu1pKQ==
|
||||
dependencies:
|
||||
icss-utils "^5.1.0"
|
||||
postcss "^8.4.21"
|
||||
postcss "^8.4.19"
|
||||
postcss-modules-extract-imports "^3.0.0"
|
||||
postcss-modules-local-by-default "^4.0.3"
|
||||
postcss-modules-local-by-default "^4.0.0"
|
||||
postcss-modules-scope "^3.0.0"
|
||||
postcss-modules-values "^4.0.0"
|
||||
postcss-value-parser "^4.2.0"
|
||||
@@ -5876,10 +5876,10 @@ nan@2.17.0, nan@^2.15.0, nan@^2.16.0:
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb"
|
||||
integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==
|
||||
|
||||
nanoid@^3.3.6:
|
||||
version "3.3.6"
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
|
||||
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
|
||||
nanoid@^3.3.4:
|
||||
version "3.3.4"
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
|
||||
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
|
||||
|
||||
natural-compare-lite@^1.4.0:
|
||||
version "1.4.0"
|
||||
@@ -6825,10 +6825,10 @@ postcss-modules-extract-imports@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz#cda1f047c0ae80c97dbe28c3e76a43b88025741d"
|
||||
integrity sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==
|
||||
|
||||
postcss-modules-local-by-default@^4.0.3:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.3.tgz#b08eb4f083050708998ba2c6061b50c2870ca524"
|
||||
integrity sha512-2/u2zraspoACtrbFRnTijMiQtb4GW4BvatjaG/bCjYQo8kLTdevCUlwuBHx2sCnSyrI3x3qj4ZK1j5LQBgzmwA==
|
||||
postcss-modules-local-by-default@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.0.0.tgz#ebbb54fae1598eecfdf691a02b3ff3b390a5a51c"
|
||||
integrity sha512-sT7ihtmGSF9yhm6ggikHdV0hlziDTX7oFoXtuVWeDd3hHObNkcHRo9V3yg7vCAY7cONyxJC/XXCmmiHHcvX7bQ==
|
||||
dependencies:
|
||||
icss-utils "^5.0.0"
|
||||
postcss-selector-parser "^6.0.2"
|
||||
@@ -6856,17 +6856,22 @@ postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4:
|
||||
cssesc "^3.0.0"
|
||||
util-deprecate "^1.0.2"
|
||||
|
||||
postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
|
||||
postcss-value-parser@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
|
||||
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==
|
||||
|
||||
postcss-value-parser@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
|
||||
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==
|
||||
|
||||
postcss@^8.4.21:
|
||||
version "8.4.24"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.24.tgz#f714dba9b2284be3cc07dbd2fc57ee4dc972d2df"
|
||||
integrity sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==
|
||||
postcss@^8.4.19:
|
||||
version "8.4.21"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.21.tgz#c639b719a57efc3187b13a1d765675485f4134f4"
|
||||
integrity sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==
|
||||
dependencies:
|
||||
nanoid "^3.3.6"
|
||||
nanoid "^3.3.4"
|
||||
picocolors "^1.0.0"
|
||||
source-map-js "^1.0.2"
|
||||
|
||||
|
Reference in New Issue
Block a user