This commit is contained in:
Eugene Pankov 2017-04-28 16:55:51 +02:00
parent 633ef9e791
commit cfd26ba4ea
8 changed files with 58 additions and 24 deletions

View file

@ -88,13 +88,18 @@ setupWindowManagement = () => {
})
electron.ipcMain.on('window-set-bounds', (event, bounds) => {
app.window.setBounds(bounds)
let actualBounds = app.window.getBounds()
actualBounds.x = bounds.x
actualBounds.y = bounds.y
app.window.setBounds(actualBounds)
setTimeout(() => {
let actualBounds = app.window.getBounds()
actualBounds = app.window.getBounds()
bounds.width += bounds.x - actualBounds.x
bounds.height += bounds.y - actualBounds.y
bounds.x = actualBounds.x
bounds.y = actualBounds.y
app.window.setBounds(bounds)
}, 500)
}, 100)
})
electron.ipcMain.on('window-set-always-on-top', (event, flag) => {
@ -148,8 +153,8 @@ start = () => {
height: 400,
//icon: `${app.getAppPath()}/assets/img/icon.png`,
title: 'Terminus',
minWidth: 300,
minHeight: 100,
minWidth: 400,
minHeight: 300,
'web-preferences': {'web-security': false},
//- background to avoid the flash of unstyled window
backgroundColor: '#131d27',
@ -158,7 +163,7 @@ start = () => {
}
Object.assign(options, windowConfig.get('windowBoundaries'))
if ((configData.appearance || {}).useNativeFrame) {
if ((configData.appearance || {}).frame == 'native') {
options.frame = true
} else {
if (platform == 'darwin') {

View file

@ -1,9 +1,9 @@
//title-bar(*ngIf='!config.store.appearance.useNativeFrame && config.store.appearance.dock == "off"')
title-bar(*ngIf='config.store.appearance.frame == "full" && config.store.appearance.dock == "off"')
.content(
[class.tabs-on-top]='config.store.appearance.tabsOnTop'
)
.tab-bar(*ngIf='app.tabs.length > 0')
.tab-bar
.tabs
tab-header(
*ngFor='let tab of app.tabs; let idx = index',
@ -32,6 +32,22 @@
)
i.fa([class]='"fa fa-" + button.icon')
button.btn.btn-secondary.btn-minimize(
*ngIf='config.store.appearance.frame == "thin"',
(click)='hostApp.minimize()',
)
i.fa.fa-window-minimize
button.btn.btn-secondary.btn-maximize(
*ngIf='config.store.appearance.frame == "thin"',
(click)='hostApp.toggleMaximize()',
)
i.fa.fa-window-maximize
button.btn.btn-secondary.btn-close(
*ngIf='config.store.appearance.frame == "thin"',
(click)='hostApp.quit()',
)
i.fa.fa-close
start-page(*ngIf='app.tabs.length == 0')
tab-body(

View file

@ -44,6 +44,18 @@ $tab-border-radius: 4px;
color: #aaa;
border: none;
border-radius: 0;
&.btn-minimize {
margin-left: 10px;
}
&.btn-minimize, &.btn-maximize {
font-size: 8px;
}
&.btn-close {
font-size: 12px;
}
}
&>.tabs {

View file

@ -123,9 +123,6 @@ export class AppRootComponent {
}
}
}
setImmediate(() => {
this.docking.dock()
})
}
getLeftToolbarButtons (): IToolbarButton[] { return this.getToolbarButtons(false) }

View file

@ -4,4 +4,4 @@ appearance:
dockFill: 50
tabsOnTop: true
theme: 'Standard'
useNativeFrame: false
frame: 'thin'

View file

@ -52,8 +52,10 @@ export class DockingService {
}
this.hostApp.setAlwaysOnTop(true)
this.hostApp.unmaximize()
this.hostApp.setBounds(newBounds)
//this.hostApp.unmaximize()
setImmediate(() => {
this.hostApp.setBounds(newBounds)
})
}
getCurrentScreen () {

View file

@ -84,14 +84,10 @@ title-bar {
app-root {
background: $body-bg;
&> .content {
background: $body-bg2;
.tab-bar {
background: $body-bg;
&>button {
&:not(:hover):not(:active) {
background: $body-bg2;

View file

@ -19,8 +19,8 @@ ngb-tabset.vertical(type='tabs')
label Show tabs
br
div(
'[(ngModel)]'='config.store.appearance.tabsOnTop'
'(ngModelChange)'='config.save()'
'[(ngModel)]'='config.store.appearance.tabsOnTop',
(ngModelChange)='config.save()',
ngbRadioGroup
)
label.btn.btn-secondary
@ -40,22 +40,28 @@ ngb-tabset.vertical(type='tabs')
label Window frame
br
div(
'[(ngModel)]'='config.store.appearance.useNativeFrame'
'[(ngModel)]'='config.store.appearance.frame'
'(ngModelChange)'='config.save(); config.requestRestart()'
ngbRadioGroup
)
label.btn.btn-secondary
input(
type='radio',
[value]='true'
[value]='"native"'
)
| Native
label.btn.btn-secondary
input(
type='radio',
[value]='false'
[value]='"thin"'
)
| Custom
| Thin
label.btn.btn-secondary
input(
type='radio',
[value]='"full"'
)
| Full
small.form-text.text-muted Whether a custom window or an OS native window should be used
.row