mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-02 06:31:52 +00:00
added docking space adjustment - fixes #3524
This commit is contained in:
@@ -2,6 +2,7 @@ appearance:
|
|||||||
dock: off
|
dock: off
|
||||||
dockScreen: current
|
dockScreen: current
|
||||||
dockFill: 0.5
|
dockFill: 0.5
|
||||||
|
dockSpace: 1
|
||||||
dockHideOnBlur: false
|
dockHideOnBlur: false
|
||||||
dockAlwaysOnTop: true
|
dockAlwaysOnTop: true
|
||||||
flexTabs: false
|
flexTabs: false
|
||||||
|
@@ -34,25 +34,30 @@ export class DockingService {
|
|||||||
const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
|
const newBounds: Bounds = { x: 0, y: 0, width: 0, height: 0 }
|
||||||
|
|
||||||
const fill = this.config.store.appearance.dockFill <= 1 ? this.config.store.appearance.dockFill : 1
|
const fill = this.config.store.appearance.dockFill <= 1 ? this.config.store.appearance.dockFill : 1
|
||||||
|
const space = this.config.store.appearance.dockSpace <= 1 ? this.config.store.appearance.dockSpace : 1
|
||||||
const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
|
const [minWidth, minHeight] = this.hostApp.getWindow().getMinimumSize()
|
||||||
|
|
||||||
if (dockSide === 'left' || dockSide === 'right') {
|
if (dockSide === 'left' || dockSide === 'right') {
|
||||||
newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
|
newBounds.width = Math.max(minWidth, Math.round(fill * display.bounds.width))
|
||||||
newBounds.height = display.bounds.height
|
newBounds.height = Math.round(display.bounds.height * space)
|
||||||
}
|
}
|
||||||
if (dockSide === 'top' || dockSide === 'bottom') {
|
if (dockSide === 'top' || dockSide === 'bottom') {
|
||||||
newBounds.width = display.bounds.width
|
newBounds.width = Math.round(display.bounds.width * space)
|
||||||
newBounds.height = Math.max(minHeight, Math.round(fill * display.bounds.height))
|
newBounds.height = Math.max(minHeight, Math.round(fill * display.bounds.height))
|
||||||
}
|
}
|
||||||
if (dockSide === 'right') {
|
if (dockSide === 'right') {
|
||||||
newBounds.x = display.bounds.x + display.bounds.width - newBounds.width
|
newBounds.x = display.bounds.x + display.bounds.width - newBounds.width
|
||||||
} else {
|
} else if (dockSide === 'left') {
|
||||||
newBounds.x = display.bounds.x
|
newBounds.x = display.bounds.x
|
||||||
|
} else {
|
||||||
|
newBounds.x = display.bounds.x + Math.round(display.bounds.width / 2 * (1 - space))
|
||||||
}
|
}
|
||||||
if (dockSide === 'bottom') {
|
if (dockSide === 'bottom') {
|
||||||
newBounds.y = display.bounds.y + display.bounds.height - newBounds.height
|
newBounds.y = display.bounds.y + display.bounds.height - newBounds.height
|
||||||
} else {
|
} else if (dockSide === 'top') {
|
||||||
newBounds.y = display.bounds.y
|
newBounds.y = display.bounds.y
|
||||||
|
} else {
|
||||||
|
newBounds.y = display.bounds.y + Math.round(display.bounds.height / 2 * (1 - space))
|
||||||
}
|
}
|
||||||
|
|
||||||
const alwaysOnTop = this.config.store.appearance.dockAlwaysOnTop
|
const alwaysOnTop = this.config.store.appearance.dockAlwaysOnTop
|
||||||
|
@@ -220,7 +220,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
|||||||
)
|
)
|
||||||
| Bottom
|
| Bottom
|
||||||
|
|
||||||
.form-line(*ngIf='config.store.appearance.dock != "off"')
|
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
|
||||||
.header
|
.header
|
||||||
.title Display on
|
.title Display on
|
||||||
.description Snaps the window to a side of the screen
|
.description Snaps the window to a side of the screen
|
||||||
@@ -245,7 +245,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
|||||||
)
|
)
|
||||||
| {{screen.name}}
|
| {{screen.name}}
|
||||||
|
|
||||||
.form-line(*ngIf='config.store.appearance.dock != "off"')
|
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
|
||||||
.header
|
.header
|
||||||
.title Dock always on top
|
.title Dock always on top
|
||||||
.description Keep docked terminal always on top
|
.description Keep docked terminal always on top
|
||||||
@@ -254,7 +254,7 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
|||||||
(ngModelChange)='saveConfiguration(); docking.dock()',
|
(ngModelChange)='saveConfiguration(); docking.dock()',
|
||||||
)
|
)
|
||||||
|
|
||||||
.form-line(*ngIf='config.store.appearance.dock != "off"')
|
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
|
||||||
.header
|
.header
|
||||||
.title Docked terminal size
|
.title Docked terminal size
|
||||||
input(
|
input(
|
||||||
@@ -266,7 +266,19 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
|||||||
step='0.01'
|
step='0.01'
|
||||||
)
|
)
|
||||||
|
|
||||||
.form-line(*ngIf='config.store.appearance.dock != "off"')
|
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
|
||||||
|
.header
|
||||||
|
.title Docked terminal space
|
||||||
|
input(
|
||||||
|
type='range',
|
||||||
|
[(ngModel)]='config.store.appearance.dockSpace',
|
||||||
|
(mouseup)='saveConfiguration(); docking.dock()',
|
||||||
|
min='0.2',
|
||||||
|
max='1',
|
||||||
|
step='0.01'
|
||||||
|
)
|
||||||
|
|
||||||
|
.ml-5.form-line(*ngIf='config.store.appearance.dock != "off"')
|
||||||
.header
|
.header
|
||||||
.title Hide dock on blur
|
.title Hide dock on blur
|
||||||
.description Hides the docked terminal when you click away.
|
.description Hides the docked terminal when you click away.
|
||||||
|
Reference in New Issue
Block a user