Merge pull request #3084 from TakuroOnoda/feature/sidetab

This commit is contained in:
Eugene 2020-12-06 19:20:17 +01:00 committed by GitHub
commit 204c1057db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 11 deletions

View File

@ -4,11 +4,15 @@ title-bar(
) )
.content( .content(
[class.tabs-on-top]='config.store.appearance.tabsLocation == "top"' [class.tabs-on-top]='config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left"',
[class.tabs-on-side]='hasVerticalTabs()',
) )
.tab-bar .tab-bar
.inset.background(*ngIf='hostApp.platform == Platform.macOS && config.store.appearance.frame == "thin" && config.store.appearance.tabsLocation == "top"') .inset.background(*ngIf='hostApp.platform == Platform.macOS \
&& config.store.appearance.frame == "thin" \
&& (config.store.appearance.tabsLocation == "top" || config.store.appearance.tabsLocation == "left")')
.tabs( .tabs(
*ngIf='config.store.appearance.tabsLocation != "bottom"'
dnd-sortable-container, dnd-sortable-container,
[sortableData]='app.tabs', [sortableData]='app.tabs',
) )
@ -24,6 +28,7 @@ title-bar(
[active]='tab == app.activeTab', [active]='tab == app.activeTab',
[hasActivity]='tab.activity$|async', [hasActivity]='tab.activity$|async',
@animateTab, @animateTab,
[@.disabled]='hasVerticalTabs()',
(click)='app.selectTab(tab)', (click)='app.selectTab(tab)',
[class.fully-draggable]='hostApp.platform != Platform.macOS', [class.fully-draggable]='hostApp.platform != Platform.macOS',
[class.drag-region]='hostApp.platform == Platform.macOS && !tabsDragging', [class.drag-region]='hostApp.platform == Platform.macOS && !tabsDragging',
@ -87,7 +92,8 @@ title-bar(
) )
window-controls.background( window-controls.background(
*ngIf='config.store.appearance.frame == "thin" && (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)', *ngIf='config.store.appearance.frame == "thin" \
&& (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)',
) )
start-page(*ngIf='ready && app.tabs.length == 0') start-page(*ngIf='ready && app.tabs.length == 0')

View File

@ -15,10 +15,18 @@
$tabs-height: 38px; $tabs-height: 38px;
$tab-border-radius: 4px; $tab-border-radius: 4px;
$side-tab-width: 200px;
.wrap {
display: flex;
width: 100vw;
height: 100vh;
flex-direction: row;
}
.content { .content {
height: 100%; width: 100vw;
height: 100vh;
flex: auto; flex: auto;
display: flex; display: flex;
flex-direction: column-reverse; flex-direction: column-reverse;
@ -26,15 +34,50 @@ $tab-border-radius: 4px;
&.tabs-on-top { &.tabs-on-top {
flex-direction: column; flex-direction: column;
} }
&.tabs-on-side {
flex-direction: row-reverse;
&.tabs-on-top {
flex-direction: row;
}
}
} }
.content.tabs-on-side > .tab-bar {
height: 100%;
width: $side-tab-width;
overflow-y: auto;
overflow-x: hidden;
flex-direction: column;
background: rgba(0, 0, 0, 0.25);
.tabs {
width: $side-tab-width;
flex: none;
flex-direction: column;
tab-header {
flex: 0 0 $tabs-height;
}
}
.drag-space {
flex: auto;
}
}
.tab-bar { .tab-bar {
flex: none; flex: none;
height: $tabs-height; height: $tabs-height;
display: flex; display: flex;
width: 100%;
.btn-tab-bar { .btn-tab-bar {
line-height: $tabs-height + 2px; line-height: $tabs-height + 2px;
height: $tabs-height;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
@ -74,7 +117,10 @@ $tab-border-radius: 4px;
& > .inset { & > .inset {
width: 85px; width: 85px;
height: $tabs-height;
flex: none; flex: none;
opacity: 0;
-webkit-app-region: drag;
} }
window-controls { window-controls {

View File

@ -184,6 +184,10 @@ export class AppRootComponent {
return false return false
} }
hasVerticalTabs () {
return this.config.store.appearance.tabsLocation === 'left' || this.config.store.appearance.tabsLocation === 'right'
}
async updateApp () { async updateApp () {
if ((await this.electron.showMessageBox( if ((await this.electron.showMessageBox(
this.hostApp.getWindow(), this.hostApp.getWindow(),

View File

@ -13,6 +13,11 @@ $tabs-height: 38px;
overflow: hidden; overflow: hidden;
&.vertical {
flex: none;
height: $tabs-height;
}
.index { .index {
flex: none; flex: none;
font-weight: bold; font-weight: bold;

View File

@ -43,14 +43,28 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
ngbButton, ngbButton,
[value]='"top"' [value]='"top"'
) )
| On the top | Top
label.btn.btn-secondary(ngbButtonLabel) label.btn.btn-secondary(ngbButtonLabel)
input( input(
type='radio', type='radio',
ngbButton, ngbButton,
[value]='"bottom"' [value]='"bottom"'
) )
| At the bottom | Bottom
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
[value]='"left"'
)
| Left
label.btn.btn-secondary(ngbButtonLabel)
input(
type='radio',
ngbButton,
[value]='"right"'
)
| Right
.form-line .form-line
.header .header

View File

@ -65,7 +65,7 @@ export class SettingsTabComponent extends BaseTabComponent {
const onConfigChange = () => { const onConfigChange = () => {
this.configFile = config.readRaw() this.configFile = config.readRaw()
this.padWindowControls = hostApp.platform === Platform.macOS this.padWindowControls = hostApp.platform === Platform.macOS
&& config.store.appearance.tabsLocation === 'bottom' && config.store.appearance.tabsLocation !== 'top'
} }
this.configSubscription = config.changed$.subscribe(onConfigChange) this.configSubscription = config.changed$.subscribe(onConfigChange)

View File

@ -10,9 +10,7 @@
"scripts": { "scripts": {
"build": "webpack --progress --color", "build": "webpack --progress --color",
"watch": "webpack --progress --color --watch", "watch": "webpack --progress --color --watch",
"postinstall": "run-script-os", "postinstall": "xcopy /i /y node_modules\\ssh2\\util\\pagent.exe util\\"
"postinstall:win32": "xcopy /i node_modules\\ssh2\\util\\pagent.exe util\\",
"postinstall:darwin:linux": "exit"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -360,7 +360,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
this.topPadded = this.hostApp.platform === Platform.macOS this.topPadded = this.hostApp.platform === Platform.macOS
&& this.config.store.appearance.frame === 'thin' && this.config.store.appearance.frame === 'thin'
&& this.config.store.appearance.tabsLocation === 'bottom' && this.config.store.appearance.tabsLocation !== 'top'
if (this.config.store.terminal.background === 'colorScheme') { if (this.config.store.terminal.background === 'colorScheme') {
if (this.config.store.terminal.colorScheme.background) { if (this.config.store.terminal.colorScheme.background) {