Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
ca9f1148
T
Tabby
项目概览
后端镜像
/
Tabby
通知
31
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ca9f1148
编写于
7月 13, 2021
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move terminal-tab to use .profile
上级
9d224cbc
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
69 addition
and
45 deletion
+69
-45
tabby-core/src/api/profileProvider.ts
tabby-core/src/api/profileProvider.ts
+1
-1
tabby-local/src/components/terminalTab.component.ts
tabby-local/src/components/terminalTab.component.ts
+17
-10
tabby-local/src/profiles.ts
tabby-local/src/profiles.ts
+23
-5
tabby-local/src/recoveryProvider.ts
tabby-local/src/recoveryProvider.ts
+8
-5
tabby-local/src/services/terminal.service.ts
tabby-local/src/services/terminal.service.ts
+1
-12
tabby-local/src/session.ts
tabby-local/src/session.ts
+0
-2
tabby-local/src/tabContextMenu.ts
tabby-local/src/tabContextMenu.ts
+19
-9
tabby-terminal/src/session.ts
tabby-terminal/src/session.ts
+0
-1
未找到文件。
tabby-core/src/api/profileProvider.ts
浏览文件 @
ca9f1148
...
...
@@ -8,7 +8,7 @@ export interface Profile {
type
:
string
name
:
string
group
?:
string
options
?
:
Record
<
string
,
any
>
options
:
Record
<
string
,
any
>
icon
?:
string
color
?:
string
...
...
tabby-local/src/components/terminalTab.component.ts
浏览文件 @
ca9f1148
import
{
Component
,
Input
,
Injector
}
from
'
@angular/core
'
import
{
BaseTabProcess
,
WIN_BUILD_CONPTY_SUPPORTED
,
isWindowsBuild
}
from
'
tabby-core
'
import
{
BaseTerminalTabComponent
}
from
'
tabby-terminal
'
import
{
SessionOptions
}
from
'
../api
'
import
{
LocalProfile
}
from
'
../api
'
import
{
Session
}
from
'
../session
'
import
{
UACService
}
from
'
../services/uac.service
'
import
{
SessionOptions
}
from
'
http2
'
/** @hidden */
@
Component
({
...
...
@@ -13,7 +14,8 @@ import { UACService } from '../services/uac.service'
animations
:
BaseTerminalTabComponent
.
animations
,
})
export
class
TerminalTabComponent
extends
BaseTerminalTabComponent
{
@
Input
()
sessionOptions
:
SessionOptions
@
Input
()
sessionOptions
:
SessionOptions
// Deprecated
@
Input
()
profile
:
LocalProfile
session
:
Session
|
null
=
null
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
...
...
@@ -25,6 +27,8 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
}
ngOnInit
():
void
{
this
.
sessionOptions
=
this
.
profile
.
options
this
.
logger
=
this
.
log
.
create
(
'
terminalTab
'
)
this
.
session
=
new
Session
(
this
.
injector
)
...
...
@@ -49,17 +53,17 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
protected
onFrontendReady
():
void
{
this
.
initializeSession
(
this
.
size
.
columns
,
this
.
size
.
rows
)
this
.
savedStateIsLive
=
this
.
sessionO
ptions
.
restoreFromPTYID
===
this
.
session
?.
getPTYID
()
this
.
savedStateIsLive
=
this
.
profile
.
o
ptions
.
restoreFromPTYID
===
this
.
session
?.
getPTYID
()
super
.
onFrontendReady
()
}
initializeSession
(
columns
:
number
,
rows
:
number
):
void
{
if
(
this
.
sessionO
ptions
.
runAsAdministrator
&&
this
.
uac
.
isAvailable
)
{
this
.
sessionOptions
=
this
.
uac
.
patchSessionOptionsForUAC
(
this
.
sessionO
ptions
)
if
(
this
.
profile
.
o
ptions
.
runAsAdministrator
&&
this
.
uac
.
isAvailable
)
{
this
.
profile
.
options
=
this
.
uac
.
patchSessionOptionsForUAC
(
this
.
profile
.
o
ptions
)
}
this
.
session
!
.
start
({
...
this
.
sessionO
ptions
,
...
this
.
profile
.
o
ptions
,
width
:
columns
,
height
:
rows
,
})
...
...
@@ -72,11 +76,14 @@ export class TerminalTabComponent extends BaseTerminalTabComponent {
const
cwd
=
this
.
session
?
await
this
.
session
.
getWorkingDirectory
()
:
null
return
{
type
:
'
app:terminal-tab
'
,
sessionOptions
:
{
...
this
.
sessionOptions
,
cwd
:
cwd
??
this
.
sessionOptions
.
cwd
,
profile
:
{
...
this
.
profile
,
options
:
{
...
this
.
profile
.
options
,
cwd
:
cwd
??
this
.
profile
.
options
.
cwd
,
restoreFromPTYID
:
this
.
session
?.
getPTYID
(),
},
},
savedState
:
this
.
frontend
?.
saveState
(),
}
}
...
...
tabby-local/src/profiles.ts
浏览文件 @
ca9f1148
import
deepClone
from
'
clone-deep
'
import
{
Injectable
,
Inject
}
from
'
@angular/core
'
import
{
ProfileProvider
,
Profile
,
NewTabParameters
,
ConfigService
,
SplitTabComponent
,
AppService
}
from
'
tabby-core
'
import
{
TerminalTabComponent
}
from
'
./components/terminalTab.component
'
...
...
@@ -9,6 +10,21 @@ export class LocalProfilesService extends ProfileProvider {
id
=
'
local
'
name
=
'
Local
'
settingsComponent
=
LocalProfileSettingsComponent
configDefaults
=
{
options
:
{
restoreFromPTYID
:
null
,
command
:
''
,
args
:
[],
cwd
:
null
,
env
:
{
__nonStructural
:
true
,
},
width
:
null
,
height
:
null
,
pauseAfterExit
:
false
,
runAsAdministrator
:
false
,
},
}
constructor
(
private
app
:
AppService
,
...
...
@@ -30,17 +46,19 @@ export class LocalProfilesService extends ProfileProvider {
}
async
getNewTabParameters
(
profile
:
Profile
):
Promise
<
NewTabParameters
<
TerminalTabComponent
>>
{
const
options
=
{
...
profile
.
options
}
profile
=
deepClone
(
profile
)
if
(
!
options
.
cwd
)
{
if
(
!
profile
.
options
?
.
cwd
)
{
if
(
this
.
app
.
activeTab
instanceof
TerminalTabComponent
&&
this
.
app
.
activeTab
.
session
)
{
options
.
cwd
=
await
this
.
app
.
activeTab
.
session
.
getWorkingDirectory
()
profile
.
options
??=
{}
profile
.
options
.
cwd
=
await
this
.
app
.
activeTab
.
session
.
getWorkingDirectory
()
}
if
(
this
.
app
.
activeTab
instanceof
SplitTabComponent
)
{
const
focusedTab
=
this
.
app
.
activeTab
.
getFocusedTab
()
if
(
focusedTab
instanceof
TerminalTabComponent
&&
focusedTab
.
session
)
{
options
.
cwd
=
await
focusedTab
.
session
.
getWorkingDirectory
()
profile
.
options
??=
{}
profile
.
options
.
cwd
=
await
focusedTab
.
session
.
getWorkingDirectory
()
}
}
}
...
...
@@ -48,7 +66,7 @@ export class LocalProfilesService extends ProfileProvider {
return
{
type
:
TerminalTabComponent
,
inputs
:
{
sessionOptions
:
options
,
profile
,
},
}
}
...
...
tabby-local/src/recoveryProvider.ts
浏览文件 @
ca9f1148
...
...
@@ -7,14 +7,14 @@ import { TerminalTabComponent } from './components/terminalTab.component'
@
Injectable
()
export
class
RecoveryProvider
extends
TabRecoveryProvider
<
TerminalTabComponent
>
{
async
applicableTo
(
recoveryToken
:
RecoveryToken
):
Promise
<
boolean
>
{
return
recoveryToken
.
type
===
'
app:
termin
al-tab
'
return
recoveryToken
.
type
===
'
app:
loc
al-tab
'
}
async
recover
(
recoveryToken
:
RecoveryToken
):
Promise
<
NewTabParameters
<
TerminalTabComponent
>>
{
return
{
type
:
TerminalTabComponent
,
inputs
:
{
sessionOptions
:
recoveryToken
.
sessionOptions
,
profile
:
recoveryToken
.
profile
,
savedState
:
recoveryToken
.
savedState
,
},
}
...
...
@@ -23,10 +23,13 @@ export class RecoveryProvider extends TabRecoveryProvider<TerminalTabComponent>
duplicate
(
recoveryToken
:
RecoveryToken
):
RecoveryToken
{
return
{
...
recoveryToken
,
sessionOptions
:
{
...
recoveryToken
.
sessionOptions
,
profile
:
{
...
recoveryToken
.
profile
,
options
:
{
...
recoveryToken
.
profile
.
options
,
restoreFromPTYID
:
null
,
},
},
savedState
:
null
,
}
}
...
...
tabby-local/src/services/terminal.service.ts
浏览文件 @
ca9f1148
...
...
@@ -2,7 +2,7 @@ import * as fs from 'mz/fs'
import
{
Injectable
}
from
'
@angular/core
'
import
{
Logger
,
LogService
,
ConfigService
,
AppService
,
ProfilesService
}
from
'
tabby-core
'
import
{
TerminalTabComponent
}
from
'
../components/terminalTab.component
'
import
{
SessionOptions
,
LocalProfile
}
from
'
../api
'
import
{
LocalProfile
}
from
'
../api
'
@
Injectable
({
providedIn
:
'
root
'
})
export
class
TerminalService
{
...
...
@@ -55,15 +55,4 @@ export class TerminalService {
options
,
}))
as
TerminalTabComponent
}
/**
* Open a terminal with custom session options
*/
openTabWithOptions
(
sessionOptions
:
SessionOptions
):
TerminalTabComponent
{
this
.
logger
.
info
(
'
Using session options:
'
,
sessionOptions
)
return
this
.
app
.
openNewTab
({
type
:
TerminalTabComponent
,
inputs
:
{
sessionOptions
},
})
}
}
tabby-local/src/session.ts
浏览文件 @
ca9f1148
...
...
@@ -104,8 +104,6 @@ export class Session extends BaseSession {
}
start
(
options
:
SessionOptions
):
void
{
this
.
name
=
options
.
name
??
''
let
pty
:
PTYProxy
|
null
=
null
if
(
options
.
restoreFromPTYID
)
{
...
...
tabby-local/src/tabContextMenu.ts
浏览文件 @
ca9f1148
...
...
@@ -33,8 +33,8 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider {
}
const
profile
=
{
options
:
{
...
tab
.
sessionO
ptions
,
cwd
:
await
tab
.
session
?.
getWorkingDirectory
()
??
tab
.
sessionO
ptions
.
cwd
,
...
tab
.
profile
.
o
ptions
,
cwd
:
await
tab
.
session
?.
getWorkingDirectory
()
??
tab
.
profile
.
o
ptions
.
cwd
,
},
name
,
type
:
'
local
'
,
...
...
@@ -74,7 +74,11 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
{
label
:
'
New terminal
'
,
click
:
()
=>
{
this
.
terminalService
.
openTabWithOptions
((
tab
as
any
).
sessionOptions
)
if
(
tab
instanceof
TerminalTabComponent
)
{
this
.
profilesService
.
openNewTabForProfile
(
tab
.
profile
)
}
else
{
this
.
terminalService
.
openTab
()
}
},
},
{
...
...
@@ -98,9 +102,12 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
submenu
:
profiles
.
map
(
profile
=>
({
label
:
profile
.
name
,
click
:
()
=>
{
this
.
terminalService
.
openTabWithOptions
({
this
.
profilesService
.
openNewTabForProfile
({
...
profile
,
options
:
{
...
profile
.
options
,
runAsAdministrator
:
true
,
},
})
},
})),
...
...
@@ -111,9 +118,12 @@ export class NewTabContextMenu extends TabContextMenuItemProvider {
items
.
push
({
label
:
'
Duplicate as administrator
'
,
click
:
()
=>
{
this
.
terminalService
.
openTabWithOptions
({
...
tab
.
sessionOptions
,
this
.
profilesService
.
openNewTabForProfile
({
...
tab
.
profile
,
options
:
{
...
tab
.
profile
.
options
,
runAsAdministrator
:
true
,
},
})
},
})
...
...
tabby-terminal/src/session.ts
浏览文件 @
ca9f1148
...
...
@@ -8,7 +8,6 @@ import { LoginScriptProcessor, LoginScriptsOptions } from './api/loginScriptProc
*/
export
abstract
class
BaseSession
{
open
:
boolean
name
:
string
truePID
:
number
protected
output
=
new
Subject
<
string
>
()
protected
binaryOutput
=
new
Subject
<
Buffer
>
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录