Vibrancy (fixes #5) (#383)

This commit is contained in:
Eugene Pankov
2018-08-02 10:34:46 -07:00
committed by GitHub
parent 7e253d72ea
commit cc9c66c4a9
13 changed files with 120 additions and 59 deletions

View File

@@ -8,8 +8,8 @@ title-bar(
)
.tab-bar(
*ngIf='!hostApp.isFullScreen',
[class.inset]='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"')
.tabs
tab-header(
*ngFor='let tab of app.tabs; let idx = index',
@@ -22,7 +22,7 @@ title-bar(
(click)='app.selectTab(tab)',
)
.btn-group
.btn-group.background
button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of leftToolbarButtons',
[title]='button.title',
@@ -30,9 +30,9 @@ title-bar(
)
i.fa([class]='"fa fa-" + button.icon')
.drag-space([class.persistent]='config.store.appearance.frame == "thin" && hostApp.platform != Platform.macOS')
.drag-space.background([class.persistent]='config.store.appearance.frame == "thin" && hostApp.platform != Platform.macOS')
.btn-group
.btn-group.background
button.btn.btn-secondary.btn-tab-bar(
*ngFor='let button of rightToolbarButtons',
[title]='button.title',
@@ -47,7 +47,7 @@ title-bar(
i.fa.fa-arrow-up.text-info
span.text-info Update
window-controls(
window-controls.background(
*ngIf='config.store.appearance.frame == "thin" && (hostApp.platform == Platform.Windows || hostApp.platform == Platform.Linux)',
)

View File

@@ -66,8 +66,9 @@ $tab-border-radius: 4px;
}
}
&.inset {
padding-left: 85px;
& > .inset {
width: 85px;
flex: none;
}
window-controls {

View File

@@ -126,6 +126,9 @@ export class AppRootComponent {
})
this.touchbar.update()
config.changed$.subscribe(() => this.updateVibrancy())
this.updateVibrancy()
}
onGlobalHotkey () {
@@ -189,4 +192,10 @@ export class AppRootComponent {
.filter((button) => (button.weight > 0) === aboveZero)
.sort((a: IToolbarButton, b: IToolbarButton) => (a.weight || 0) - (b.weight || 0))
}
private updateVibrancy () {
document.body.classList.toggle('vibrant', this.config.store.appearance.vibrancy)
this.hostApp.getWindow().setVibrancy(this.config.store.appearance.vibrancy ? 'dark' : null)
this.hostApp.getWindow().setOpacity(this.config.store.appearance.opacity)
}
}