mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-28 15:29:58 +00:00
allow selecting windows vibrancy type (fixes #460)
This commit is contained in:
parent
7b33d89032
commit
8f0f1b19df
@ -88,13 +88,13 @@ export class Window {
|
||||
})
|
||||
}
|
||||
|
||||
setVibrancy (enabled: boolean) {
|
||||
setVibrancy (enabled: boolean, type?: string) {
|
||||
if (process.platform === 'win32') {
|
||||
if (parseFloat(os.release()) >= 10) {
|
||||
let attribValue = AccentState.ACCENT_DISABLED
|
||||
let color = 0x00000000
|
||||
if (enabled) {
|
||||
if (parseInt(os.release().split('.')[2]) >= 17063) {
|
||||
if (parseInt(os.release().split('.')[2]) >= 17063 && type === 'fluent') {
|
||||
attribValue = AccentState.ACCENT_ENABLE_FLUENT
|
||||
color = 0x01000000 // using a small alpha because acrylic bugs out at full transparency.
|
||||
} else {
|
||||
@ -186,8 +186,8 @@ export class Window {
|
||||
this.window.setAlwaysOnTop(flag)
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-vibrancy', (_event, enabled) => {
|
||||
this.setVibrancy(enabled)
|
||||
ipcMain.on('window-set-vibrancy', (_event, enabled, type) => {
|
||||
this.setVibrancy(enabled, type)
|
||||
})
|
||||
|
||||
ipcMain.on('window-set-title', (_event, title) => {
|
||||
|
@ -224,7 +224,7 @@ export class AppRootComponent {
|
||||
}
|
||||
|
||||
private updateVibrancy () {
|
||||
this.hostApp.setVibrancy(this.config.store.appearance.vibrancy)
|
||||
this.hostApp.setVibrancy(this.config.store.appearance.vibrancy, this.config.store.appearance.vibrancyType)
|
||||
this.hostApp.getWindow().setOpacity(this.config.store.appearance.opacity)
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,5 @@ appearance:
|
||||
css: '/* * { color: blue !important; } */'
|
||||
opacity: 1.0
|
||||
vibrancy: false
|
||||
vibrancyType: 'blur'
|
||||
enableAnalytics: true
|
||||
|
@ -150,13 +150,13 @@ export class HostAppService {
|
||||
this.electron.ipcRenderer.send('window-set-always-on-top', flag)
|
||||
}
|
||||
|
||||
setVibrancy (enable: boolean) {
|
||||
setVibrancy (enable: boolean, type: string) {
|
||||
document.body.classList.toggle('vibrant', enable)
|
||||
if (this.platform === Platform.macOS) {
|
||||
this.getWindow().setVibrancy(enable ? 'dark' : null)
|
||||
}
|
||||
if (this.platform === Platform.Windows) {
|
||||
this.electron.ipcRenderer.send('window-set-vibrancy', enable)
|
||||
this.electron.ipcRenderer.send('window-set-vibrancy', enable, type)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,29 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab')
|
||||
(ngModelChange)='config.save()'
|
||||
)
|
||||
|
||||
.form-line(*ngIf='config.store.appearance.vibrancy && isFluentVibrancySupported')
|
||||
.header
|
||||
.title Vibrancy type
|
||||
.btn-group(
|
||||
[(ngModel)]='config.store.appearance.vibrancyType',
|
||||
(ngModelChange)='config.save()',
|
||||
ngbRadioGroup
|
||||
)
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"blur"'
|
||||
)
|
||||
| Blur
|
||||
label.btn.btn-secondary(ngbButtonLabel)
|
||||
input(
|
||||
type='radio',
|
||||
ngbButton,
|
||||
[value]='"fluent"'
|
||||
)
|
||||
| Fluent
|
||||
|
||||
.form-line
|
||||
.header
|
||||
.title Window opacity
|
||||
|
@ -1,4 +1,5 @@
|
||||
import * as yaml from 'js-yaml'
|
||||
import * as os from 'os'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { Component, Inject, Input } from '@angular/core'
|
||||
import { HotkeysService } from 'terminus-core'
|
||||
@ -35,6 +36,7 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
configDefaults: any
|
||||
configFile: string
|
||||
isShellIntegrationInstalled = false
|
||||
isFluentVibrancySupported = false
|
||||
private configSubscription: Subscription
|
||||
|
||||
constructor (
|
||||
@ -64,6 +66,10 @@ export class SettingsTabComponent extends BaseTabComponent {
|
||||
hotkeys.getHotkeyDescriptions().then(descriptions => {
|
||||
this.hotkeyDescriptions = descriptions
|
||||
})
|
||||
|
||||
this.isFluentVibrancySupported = process.platform === 'win32'
|
||||
&& parseFloat(os.release()) >= 10
|
||||
&& parseInt(os.release().split('.')[2]) >= 17063
|
||||
}
|
||||
|
||||
async ngOnInit () {
|
||||
|
@ -46,6 +46,7 @@ module.exports = {
|
||||
externals: [
|
||||
'fs',
|
||||
'path',
|
||||
'os',
|
||||
/^rxjs/,
|
||||
/^@angular/,
|
||||
/^@ng-bootstrap/,
|
||||
|
@ -29,12 +29,14 @@ export class TerminalService {
|
||||
|
||||
async getShells (): Promise<IShell[]> {
|
||||
let shellLists = await Promise.all(this.config.enabledServices(this.shellProviders).map(x => x.provide()))
|
||||
return shellLists.reduce((a, b) => a.concat(b))
|
||||
return shellLists.reduce((a, b) => a.concat(b), [])
|
||||
}
|
||||
|
||||
async reloadShells () {
|
||||
this.shells = new AsyncSubject<IShell[]>()
|
||||
this.shells.next(await this.getShells())
|
||||
let shells = await this.getShells()
|
||||
this.logger.debug('Shells list:', shells)
|
||||
this.shells.next(shells)
|
||||
this.shells.complete()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user