Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
94d8886d
T
Tabby
项目概览
后端镜像
/
Tabby
通知
27
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,体验更适合开发者的 AI 搜索 >>
提交
94d8886d
编写于
4月 28, 2017
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
.
上级
c7828e55
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
81 addition
and
58 deletion
+81
-58
app/index.pug
app/index.pug
+1
-1
app/src/entry.ts
app/src/entry.ts
+1
-1
app/src/plugins.ts
app/src/plugins.ts
+6
-3
terminus-core/src/components/appRoot.component.pug
terminus-core/src/components/appRoot.component.pug
+10
-4
terminus-core/src/components/appRoot.component.scss
terminus-core/src/components/appRoot.component.scss
+5
-1
terminus-core/src/components/appRoot.component.ts
terminus-core/src/components/appRoot.component.ts
+2
-1
terminus-core/src/components/tabHeader.component.scss
terminus-core/src/components/tabHeader.component.scss
+4
-0
terminus-core/src/components/titleBar.component.scss
terminus-core/src/components/titleBar.component.scss
+1
-1
terminus-core/src/components/titleBar.component.ts
terminus-core/src/components/titleBar.component.ts
+1
-7
terminus-core/src/configDefaults.yaml
terminus-core/src/configDefaults.yaml
+5
-5
terminus-core/src/theme.scss
terminus-core/src/theme.scss
+5
-14
terminus-settings/src/components/settingsTab.component.pug
terminus-settings/src/components/settingsTab.component.pug
+3
-3
terminus-terminal/src/api.ts
terminus-terminal/src/api.ts
+2
-1
terminus-terminal/src/persistenceProviders.ts
terminus-terminal/src/persistenceProviders.ts
+28
-15
terminus-terminal/src/services/sessions.service.ts
terminus-terminal/src/services/sessions.service.ts
+7
-1
未找到文件。
app/index.pug
浏览文件 @
94d8886d
...
...
@@ -29,6 +29,6 @@ html
div
h1.terminus-title Terminus
.progress
.bar(style='width:
5
0%')
.bar(style='width: 0%')
app/src/entry.ts
浏览文件 @
94d8886d
...
...
@@ -21,7 +21,7 @@ if ((<any>global).require('electron-is-dev')) {
}
findPlugins
().
then
(
async
plugins
=>
{
let
pluginsModules
=
loadPlugins
(
plugins
,
(
current
,
total
)
=>
{
let
pluginsModules
=
await
loadPlugins
(
plugins
,
(
current
,
total
)
=>
{
(
<
HTMLElement
>
document
.
querySelector
(
'
.progress .bar
'
)).
style
.
width
=
100
*
current
/
total
+
'
%
'
})
let
module
=
await
getRootModule
(
pluginsModules
)
...
...
app/src/plugins.ts
浏览文件 @
94d8886d
...
...
@@ -56,10 +56,11 @@ export async function findPlugins (): Promise<IPluginEntry[]> {
return
foundPlugins
}
export
function
loadPlugins
(
foundPlugins
:
IPluginEntry
[],
progress
:
ProgressCallback
):
any
[]
{
export
async
function
loadPlugins
(
foundPlugins
:
IPluginEntry
[],
progress
:
ProgressCallback
):
Promise
<
any
[]
>
{
let
plugins
:
any
[]
=
[]
progress
(
0
,
1
)
foundPlugins
.
forEach
((
foundPlugin
,
index
)
=>
{
let
index
=
0
for
(
let
foundPlugin
of
foundPlugins
)
{
console
.
info
(
`Loading
${
foundPlugin
.
name
}
:
${(
<
any
>
global
).
require
.
resolve
(
foundPlugin
.
path
)}
`
)
progress
(
index
,
foundPlugins
.
length
)
try
{
...
...
@@ -68,7 +69,9 @@ export function loadPlugins (foundPlugins: IPluginEntry[], progress: ProgressCal
}
catch
(
error
)
{
console
.
error
(
`Could not load
${
foundPlugin
.
name
}
:`
,
error
)
}
})
await
delay
(
1
)
index
++
}
progress
(
1
,
1
)
return
plugins
}
terminus-core/src/components/appRoot.component.pug
浏览文件 @
94d8886d
title-bar(*ngIf='config.store.appearance.frame == "full" && config.store.appearance.dock == "off"')
title-bar(
*ngIf='config.store.appearance.frame == "full" && config.store.appearance.dock == "off"',
[class.inset]='hostApp.platform == Platform.macOS'
)
.content(
[class.tabs-on-top]='config.store.appearance.tabs
OnTop
'
[class.tabs-on-top]='config.store.appearance.tabs
Location == "top"
'
)
.tab-bar
.tab-bar(
[class.inset]='hostApp.platform == Platform.macOS && config.store.appearance.frame == "thin" && config.store.appearance.tabsLocation == "top"'
)
.tabs
tab-header(
*ngFor='let tab of app.tabs; let idx = index',
...
...
@@ -11,6 +16,7 @@ title-bar(*ngIf='config.store.appearance.frame == "full" && config.store.appeara
[tab]='tab',
[active]='tab == app.activeTab',
[hasActivity]='tab.hasActivity',
[class.drag-region]='hostApp.platform == Platform.macOS',
@animateTab,
(click)='app.selectTab(tab)',
(closeClicked)='app.closeTab(tab)',
...
...
@@ -35,7 +41,7 @@ title-bar(*ngIf='config.store.appearance.frame == "full" && config.store.appeara
i.fa([class]='"fa fa-" + button.icon')
.btn-group.window-controls(
*ngIf='config.store.appearance.frame == "thin"',
*ngIf='config.store.appearance.frame == "thin"
&& (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)
',
)
button.btn.btn-secondary.btn-minimize.btn-tab-bar(
(click)='hostApp.minimize()',
...
...
terminus-core/src/components/appRoot.component.scss
浏览文件 @
94d8886d
...
...
@@ -71,9 +71,13 @@ $tab-border-radius: 4px;
-webkit-app-region
:
drag
;
}
&
.window-controls
{
.window-controls
{
flex
:
0
0
none
;
}
&
.inset
{
padding-left
:
85px
;
}
}
.tabs-content
{
...
...
terminus-core/src/components/appRoot.component.ts
浏览文件 @
94d8886d
...
...
@@ -3,7 +3,7 @@ import { trigger, style, animate, transition, state } from '@angular/animations'
import
{
ToasterConfig
}
from
'
angular2-toaster
'
import
{
ElectronService
}
from
'
../services/electron.service
'
import
{
HostAppService
}
from
'
../services/hostApp.service
'
import
{
HostAppService
,
Platform
}
from
'
../services/hostApp.service
'
import
{
HotkeysService
}
from
'
../services/hotkeys.service
'
import
{
Logger
,
LogService
}
from
'
../services/log.service
'
import
{
QuitterService
}
from
'
../services/quitter.service
'
...
...
@@ -43,6 +43,7 @@ import { AppService, IToolbarButton, ToolbarButtonProvider } from '../api'
})
export
class
AppRootComponent
{
toasterConfig
:
ToasterConfig
Platform
=
Platform
private
logger
:
Logger
constructor
(
...
...
terminus-core/src/components/tabHeader.component.scss
浏览文件 @
94d8886d
...
...
@@ -61,4 +61,8 @@ $tabs-height: 40px;
display
:
block
;
opacity
:
1
;
}
&
.drag-region
{
-webkit-app-region
:
drag
;
}
}
terminus-core/src/components/titleBar.component.scss
浏览文件 @
94d8886d
...
...
@@ -31,7 +31,7 @@ $titlebar-height: 30px;
font-size
:
12px
;
}
&
.inset
-titlebar
{
&
.inset
{
flex-basis
:
36px
;
.title
{
...
...
terminus-core/src/components/titleBar.component.ts
浏览文件 @
94d8886d
import
{
Component
,
HostBinding
}
from
'
@angular/core
'
import
{
HostAppService
,
Platform
}
from
'
../services/hostApp.service
'
import
{
Component
}
from
'
@angular/core
'
@
Component
({
selector
:
'
title-bar
'
,
...
...
@@ -7,9 +6,4 @@ import { HostAppService, Platform } from '../services/hostApp.service'
styles
:
[
require
(
'
./titleBar.component.scss
'
)],
})
export
class
TitleBarComponent
{
@
HostBinding
(
'
class.inset-titlebar
'
)
insetTitlebar
=
false
constructor
(
public
hostApp
:
HostAppService
)
{
this
.
insetTitlebar
=
hostApp
.
platform
==
Platform
.
macOS
}
}
terminus-core/src/configDefaults.yaml
浏览文件 @
94d8886d
appearance
:
dock
:
'
off'
dockScreen
:
'
current'
dock
:
off
dockScreen
:
current
dockFill
:
50
tabs
OnTop
:
true
theme
:
'
Standard'
frame
:
'
thin'
tabs
Location
:
top
theme
:
Standard
frame
:
thin
terminus-core/src/theme.scss
浏览文件 @
94d8886d
...
...
@@ -108,7 +108,6 @@ app-root {
background
:
$body-bg2
;
border-left
:
1px
solid
transparent
;
border-right
:
1px
solid
transparent
;
margin-bottom
:
-1px
;
.index
{
color
:
#555
;
...
...
@@ -133,45 +132,37 @@ app-root {
}
&
.tabs-on-top
.tab-bar
{
border-bottom
:
1px
solid
$border-color
;
tab-header
{
border-top
:
1px
solid
transparent
;
border-bottom
:
1px
solid
$border-color
;
&
.active
{
border-top
:
1px
solid
$teal
;
border-bottom
:
1px
solid
transparent
;
margin-bottom
:
-1px
;
}
&
.has-activity
:not
(
.active
)
{
border-top
:
1px
solid
$green
;
}
}
&
>
.btn-group
,
.drag-space
{
border-bottom
:
1px
solid
$border-color
;
}
}
&
:not
(
.tabs-on-top
)
.tab-bar
{
margin-bottom
:
3px
;
border-top
:
1px
solid
$border-color
;
tab-header
{
border-bottom
:
1px
solid
transparent
;
border-top
:
1px
solid
$border-color
;
&
.active
{
border-bottom
:
1px
solid
$teal
;
border-top
:
1px
solid
transparent
;
margin-top
:
-1px
;
}
&
.has-activity
:not
(
.active
)
{
border-bottom
:
1px
solid
$green
;
}
}
&
>
.btn-group
,
.drag-space
{
border-top
:
1px
solid
$border-color
;
}
}
}
}
...
...
terminus-settings/src/components/settingsTab.component.pug
浏览文件 @
94d8886d
...
...
@@ -19,20 +19,20 @@ ngb-tabset.vertical(type='tabs')
label Show tabs
br
div(
'[(ngModel)]'='config.store.appearance.tabs
OnTop
',
'[(ngModel)]'='config.store.appearance.tabs
Location
',
(ngModelChange)='config.save()',
ngbRadioGroup
)
label.btn.btn-secondary
input(
type='radio',
[value]='
true
'
[value]='
"top"
'
)
| On the top
label.btn.btn-secondary
input(
type='radio',
[value]='
false
'
[value]='
"bottom"
'
)
| At the bottom
.col.col-lg-6
...
...
terminus-terminal/src/api.ts
浏览文件 @
94d8886d
import
{
Observable
}
from
'
rxjs
'
import
{
TerminalTabComponent
}
from
'
./components/terminalTab.component
'
export
{
TerminalTabComponent
}
...
...
@@ -18,7 +19,7 @@ export interface SessionOptions {
cwd
?:
string
env
?:
any
recoveryId
?:
string
recoveredTruePID
?:
number
recoveredTruePID
$
?:
Observable
<
number
>
}
export
abstract
class
SessionPersistenceProvider
{
...
...
terminus-terminal/src/persistenceProviders.ts
浏览文件 @
94d8886d
import
*
as
fs
from
'
fs-promise
'
import
{
exec
,
spawn
}
from
'
mz/child_process
'
import
{
exec
as
execCallback
}
from
'
child_process
'
import
{
AsyncSubject
}
from
'
rxjs
'
import
{
Injectable
}
from
'
@angular/core
'
import
{
Logger
,
LogService
}
from
'
terminus-core
'
import
{
SessionOptions
,
SessionPersistenceProvider
}
from
'
./api
'
...
...
@@ -36,12 +38,12 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
}
async
attachSession
(
recoveryId
:
any
):
Promise
<
SessionOptions
>
{
let
lines
:
string
[]
try
{
lines
=
(
await
exec
(
'
screen -list
'
))[
0
].
toString
().
split
(
'
\n
'
)
}
catch
(
result
)
{
lines
=
result
.
stdout
.
split
(
'
\n
'
)
}
let
lines
=
await
new
Promise
<
string
[]
>
(
resolve
=>
{
execCallback
(
'
screen -list
'
,
(
_err
,
stdout
)
=>
{
// returns an error code on macOS
resolve
(
stdout
.
split
(
'
\n
'
))
}
)
}
)
let
screenPID
=
lines
.
filter
(
line
=>
line
.
indexOf
(
'
.
'
+
recoveryId
)
!==
-
1
)
.
map
(
line
=>
parseInt
(
line
.
trim
().
split
(
'
.
'
)[
0
]))[
0
]
...
...
@@ -50,23 +52,34 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
return
null
}
let
truePID_
=
new
AsyncSubject
<
number
>
()
this
.
extractShellPID
(
screenPID
).
then
(
pid
=>
{
truePID_
.
next
(
pid
)
truePID_
.
complete
()
})
return
{
recoveryId
,
recoveredTruePID
$
:
truePID_
.
asObservable
(),
command
:
'
screen
'
,
args
:
[
'
-r
'
,
recoveryId
],
}
}
async
extractShellPID
(
screenPID
:
number
):
Promise
<
number
>
{
let
child
=
(
await
listProcesses
()).
find
(
x
=>
x
.
ppid
===
screenPID
)
if
(
!
child
)
{
th
is
.
logger
.
e
rror
(
`Could not find any children of the screen process (PID
${
screenPID
}
)!`
)
th
row
new
E
rror
(
`Could not find any children of the screen process (PID
${
screenPID
}
)!`
)
}
if
(
child
.
command
==
'
login
'
)
{
await
delay
(
1000
)
child
=
(
await
listProcesses
()).
find
(
x
=>
x
.
ppid
===
child
.
pid
)
}
let
recoveredTruePID
=
child
.
pid
return
{
recoveryId
,
recoveredTruePID
,
command
:
'
screen
'
,
args
:
[
'
-r
'
,
recoveryId
],
}
return
child
.
pid
}
async
startSession
(
options
:
SessionOptions
):
Promise
<
any
>
{
...
...
terminus-terminal/src/services/sessions.service.ts
浏览文件 @
94d8886d
...
...
@@ -43,7 +43,13 @@ export class Session {
env
:
env
,
})
this
.
truePID
=
options
.
recoveredTruePID
||
(
<
any
>
this
.
pty
).
pid
if
(
options
.
recoveredTruePID$
)
{
options
.
recoveredTruePID$
.
subscribe
(
pid
=>
{
this
.
truePID
=
pid
})
}
else
{
this
.
truePID
=
(
<
any
>
this
.
pty
).
pid
}
this
.
open
=
true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录