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) => { 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(() => { setTimeout(() => {
let actualBounds = app.window.getBounds() actualBounds = app.window.getBounds()
bounds.width += bounds.x - actualBounds.x bounds.width += bounds.x - actualBounds.x
bounds.height += bounds.y - actualBounds.y bounds.height += bounds.y - actualBounds.y
bounds.x = actualBounds.x
bounds.y = actualBounds.y
app.window.setBounds(bounds) app.window.setBounds(bounds)
}, 500) }, 100)
}) })
electron.ipcMain.on('window-set-always-on-top', (event, flag) => { electron.ipcMain.on('window-set-always-on-top', (event, flag) => {
@ -148,8 +153,8 @@ start = () => {
height: 400, height: 400,
//icon: `${app.getAppPath()}/assets/img/icon.png`, //icon: `${app.getAppPath()}/assets/img/icon.png`,
title: 'Terminus', title: 'Terminus',
minWidth: 300, minWidth: 400,
minHeight: 100, minHeight: 300,
'web-preferences': {'web-security': false}, 'web-preferences': {'web-security': false},
//- background to avoid the flash of unstyled window //- background to avoid the flash of unstyled window
backgroundColor: '#131d27', backgroundColor: '#131d27',
@ -158,7 +163,7 @@ start = () => {
} }
Object.assign(options, windowConfig.get('windowBoundaries')) Object.assign(options, windowConfig.get('windowBoundaries'))
if ((configData.appearance || {}).useNativeFrame) { if ((configData.appearance || {}).frame == 'native') {
options.frame = true options.frame = true
} else { } else {
if (platform == 'darwin') { 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( .content(
[class.tabs-on-top]='config.store.appearance.tabsOnTop' [class.tabs-on-top]='config.store.appearance.tabsOnTop'
) )
.tab-bar(*ngIf='app.tabs.length > 0') .tab-bar
.tabs .tabs
tab-header( tab-header(
*ngFor='let tab of app.tabs; let idx = index', *ngFor='let tab of app.tabs; let idx = index',
@ -32,6 +32,22 @@
) )
i.fa([class]='"fa fa-" + button.icon') 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') start-page(*ngIf='app.tabs.length == 0')
tab-body( tab-body(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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