Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
b29ab269
T
Tabby
项目概览
后端镜像
/
Tabby
通知
37
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,发现更多精彩内容 >>
提交
b29ab269
编写于
4月 19, 2020
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WSL2 support - fixes #271
上级
f58cab08
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
34 addition
and
20 deletion
+34
-20
terminus-core/src/services/config.service.ts
terminus-core/src/services/config.service.ts
+2
-0
terminus-terminal/src/api/interfaces.ts
terminus-terminal/src/api/interfaces.ts
+1
-0
terminus-terminal/src/components/shellSettingsTab.component.pug
...us-terminal/src/components/shellSettingsTab.component.pug
+1
-1
terminus-terminal/src/components/shellSettingsTab.component.ts
...nus-terminal/src/components/shellSettingsTab.component.ts
+10
-10
terminus-terminal/src/components/terminalSettingsTab.component.pug
...terminal/src/components/terminalSettingsTab.component.pug
+1
-1
terminus-terminal/src/hotkeys.ts
terminus-terminal/src/hotkeys.ts
+1
-2
terminus-terminal/src/index.ts
terminus-terminal/src/index.ts
+1
-3
terminus-terminal/src/services/terminal.service.ts
terminus-terminal/src/services/terminal.service.ts
+14
-2
terminus-terminal/src/shells/wsl.ts
terminus-terminal/src/shells/wsl.ts
+3
-1
未找到文件。
terminus-core/src/services/config.service.ts
浏览文件 @
b29ab269
...
...
@@ -155,6 +155,8 @@ export class ConfigService {
}
save
():
void
{
// Scrub undefined values
this
.
_store
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
_store
))
fs
.
writeFileSync
(
this
.
path
,
yaml
.
safeDump
(
this
.
_store
),
'
utf8
'
)
this
.
emitChange
()
this
.
hostApp
.
broadcastConfigChange
(
this
.
store
)
...
...
terminus-terminal/src/api/interfaces.ts
浏览文件 @
b29ab269
...
...
@@ -19,6 +19,7 @@ export interface Profile {
name
:
string
color
?:
string
sessionOptions
:
SessionOptions
shell
?:
string
isBuiltin
?:
boolean
icon
?:
string
}
...
...
terminus-terminal/src/components/shellSettingsTab.component.pug
浏览文件 @
b29ab269
...
...
@@ -11,7 +11,7 @@ h3.mb-3 Shell
)
option(
*ngFor='let profile of profiles',
[ngValue]='
slugify(profile.name).toLowerCase(
)'
[ngValue]='
terminal.getProfileID(profile
)'
) {{profile.name}}
...
...
terminus-terminal/src/components/shellSettingsTab.component.ts
浏览文件 @
b29ab269
import
slugify
from
'
slugify
'
import
{
Component
}
from
'
@angular/core
'
import
{
NgbModal
}
from
'
@ng-bootstrap/ng-bootstrap
'
import
{
Subscription
}
from
'
rxjs
'
...
...
@@ -17,14 +16,13 @@ export class ShellSettingsTabComponent {
Platform
=
Platform
isConPTYAvailable
:
boolean
isConPTYStable
:
boolean
slugify
=
slugify
private
configSubscription
:
Subscription
constructor
(
public
config
:
ConfigService
,
public
hostApp
:
HostAppService
,
public
terminal
:
TerminalService
,
private
electron
:
ElectronService
,
private
terminalService
:
TerminalService
,
private
ngbModal
:
NgbModal
,
)
{
config
.
store
.
terminal
.
environment
=
config
.
store
.
terminal
.
environment
||
{}
...
...
@@ -38,7 +36,7 @@ export class ShellSettingsTabComponent {
}
async
ngOnInit
():
Promise
<
void
>
{
this
.
shells
=
await
this
.
terminal
Service
.
shells$
.
toPromise
()
this
.
shells
=
await
this
.
terminal
.
shells$
.
toPromise
()
}
ngOnDestroy
():
void
{
...
...
@@ -46,21 +44,22 @@ export class ShellSettingsTabComponent {
}
async
reload
():
Promise
<
void
>
{
this
.
profiles
=
await
this
.
terminal
Service
.
getProfiles
({
includeHidden
:
true
})
this
.
profiles
=
await
this
.
terminal
.
getProfiles
({
includeHidden
:
true
})
}
pickWorkingDirectory
():
void
{
const
shell
=
this
.
shells
.
find
(
x
=>
x
.
id
===
this
.
config
.
store
.
terminal
.
shell
)
async
pickWorkingDirectory
():
Promise
<
void
>
{
const
profile
=
await
this
.
terminal
.
getProfileByID
(
this
.
config
.
store
.
terminal
.
profile
)
const
shell
=
this
.
shells
.
find
(
x
=>
x
.
id
===
profile
?.
shell
)
if
(
!
shell
)
{
return
}
const
paths
=
this
.
electron
.
dialog
.
showOpenDialog
(
const
paths
=
(
await
this
.
electron
.
dialog
.
showOpenDialog
(
this
.
hostApp
.
getWindow
(),
{
defaultPath
:
shell
.
fsBase
,
properties
:
[
'
openDirectory
'
,
'
showHiddenFiles
'
],
}
)
)
).
filePaths
if
(
paths
)
{
this
.
config
.
store
.
terminal
.
workingDirectory
=
paths
[
0
]
}
...
...
@@ -69,7 +68,8 @@ export class ShellSettingsTabComponent {
newProfile
(
shell
:
Shell
):
void
{
const
profile
:
Profile
=
{
name
:
shell
.
name
||
''
,
sessionOptions
:
this
.
terminalService
.
optionsFromShell
(
shell
),
shell
:
shell
.
id
,
sessionOptions
:
this
.
terminal
.
optionsFromShell
(
shell
),
}
this
.
config
.
store
.
terminal
.
profiles
=
[
profile
,
...
this
.
config
.
store
.
terminal
.
profiles
]
this
.
config
.
save
()
...
...
terminus-terminal/src/components/terminalSettingsTab.component.pug
浏览文件 @
b29ab269
...
...
@@ -30,7 +30,7 @@ h3.mb-3 Terminal
)
| Audible
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.bell != "audible" && config.store.terminal.
shell
.startsWith("wsl")')
.alert.alert-info.d-flex.align-items-center(*ngIf='config.store.terminal.bell != "audible" && config.store.terminal.
profile
.startsWith("wsl")')
.mr-auto WSL terminal bell can only be muted via Volume Mixer
button.btn.btn-secondary((click)='openWSLVolumeMixer()') Show Mixer
...
...
terminus-terminal/src/hotkeys.ts
浏览文件 @
b29ab269
import
slugify
from
'
slugify
'
import
{
Injectable
}
from
'
@angular/core
'
import
{
HotkeyDescription
,
HotkeyProvider
}
from
'
terminus-core
'
import
{
TerminalService
}
from
'
./services/terminal.service
'
...
...
@@ -78,7 +77,7 @@ export class TerminalHotkeyProvider extends HotkeyProvider {
return
[
...
this
.
hotkeys
,
...
profiles
.
map
(
profile
=>
({
id
:
`profile.
${
slugify
(
profile
.
name
).
toLowerCase
(
)}
`
,
id
:
`profile.
${
this
.
terminal
.
getProfileID
(
profile
)}
`
,
name
:
`New tab:
${
profile
.
name
}
`
,
})),
]
...
...
terminus-terminal/src/index.ts
浏览文件 @
b29ab269
import
*
as
fs
from
'
mz/fs
'
import
slugify
from
'
slugify
'
import
{
NgModule
}
from
'
@angular/core
'
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
...
...
@@ -187,8 +186,7 @@ export default class TerminalModule { // eslint-disable-line @typescript-eslint/
hostApp
.
newWindow
()
}
if
(
hotkey
.
startsWith
(
'
profile.
'
))
{
const
profiles
=
await
terminal
.
getProfiles
()
const
profile
=
profiles
.
find
(
x
=>
slugify
(
x
.
name
).
toLowerCase
()
===
hotkey
.
split
(
'
.
'
)[
1
])
const
profile
=
await
terminal
.
getProfileByID
(
hotkey
.
split
(
'
.
'
)[
1
])
if
(
profile
)
{
terminal
.
openTabWithOptions
(
profile
.
sessionOptions
)
}
...
...
terminus-terminal/src/services/terminal.service.ts
浏览文件 @
b29ab269
...
...
@@ -40,6 +40,7 @@ export class TerminalService {
...
this
.
config
.
store
.
terminal
.
profiles
,
...
skipDefault
?
[]
:
shells
.
filter
(
x
=>
includeHidden
||
!
x
.
hidden
).
map
(
shell
=>
({
name
:
shell
.
name
,
shell
:
shell
.
id
,
icon
:
shell
.
icon
,
sessionOptions
:
this
.
optionsFromShell
(
shell
),
isBuiltin
:
true
,
...
...
@@ -47,14 +48,25 @@ export class TerminalService {
]
}
getProfileID
(
profile
:
Profile
):
string
{
return
slugify
(
profile
.
name
).
toLowerCase
()
}
async
getProfileByID
(
id
:
string
):
Promise
<
Profile
>
{
const
profiles
=
await
this
.
getProfiles
({
includeHidden
:
true
})
return
profiles
.
find
(
x
=>
this
.
getProfileID
(
x
)
===
id
)
||
profiles
[
0
]
}
/**
* Launches a new terminal with a specific shell and CWD
* @param pause Wait for a keypress when the shell exits
*/
async
openTab
(
profile
?:
Profile
,
cwd
?:
string
|
null
,
pause
?:
boolean
):
Promise
<
TerminalTabComponent
>
{
if
(
!
profile
)
{
const
profiles
=
await
this
.
getProfiles
({
includeHidden
:
true
})
profile
=
profiles
.
find
(
x
=>
slugify
(
x
.
name
).
toLowerCase
()
===
this
.
config
.
store
.
terminal
.
profile
)
||
profiles
[
0
]
profile
=
await
this
.
getProfileByID
(
this
.
config
.
store
.
terminal
.
profile
)
if
(
!
profile
)
{
profile
=
(
await
this
.
getProfiles
({
includeHidden
:
true
}))[
0
]
}
}
cwd
=
cwd
||
profile
.
sessionOptions
.
cwd
...
...
terminus-terminal/src/shells/wsl.ts
浏览文件 @
b29ab269
...
...
@@ -88,13 +88,15 @@ export class WSLShellProvider extends ShellProvider {
if
(
!
childKey
.
DistributionName
)
{
continue
}
const
wslVersion
=
(
childKey
.
Flags
.
value
&
8
)
?
2
:
1
const
name
=
childKey
.
DistributionName
.
value
const
fsBase
=
(
wslVersion
===
2
)
?
`\\\\wsl$\
\$
{name}`
:
(
childKey
.
BasePath
.
value
as
string
+
'
\\
rootfs
'
)
const
shell
:
Shell
=
{
id
:
`wsl-
${
slugify
(
name
)}
`
,
name
:
`WSL /
${
name
}
`
,
command
:
wslPath
,
args
:
[
'
-d
'
,
name
],
fsBase
:
childKey
.
BasePath
.
value
as
string
+
'
\\
rootfs
'
,
fsBase
,
env
:
{
TERM
:
'
xterm-color
'
,
COLORTERM
:
'
truecolor
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录