From 9190893ccfeaf3c3b4913910dcc283328ea9a838 Mon Sep 17 00:00:00 2001 From: Gwilherm Folliot Date: Wed, 3 Jun 2020 18:41:23 +0200 Subject: [PATCH 1/2] Added acrylic background for linux --- app/lib/window.ts | 14 ++++++++++---- package.json | 1 + .../src/components/settingsTab.component.pug | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/lib/window.ts b/app/lib/window.ts index 7ee5dd22..43837eed 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -1,3 +1,5 @@ +import * as glasstron from 'glasstron' +glasstron.init() import { Subject, Observable } from 'rxjs' import { debounceTime } from 'rxjs/operators' import { BrowserWindow, app, ipcMain, Rectangle, Menu, screen } from 'electron' @@ -82,11 +84,13 @@ export class Window { } } - if (process.platform === 'linux') { - bwOptions.backgroundColor = '#131d27' - } - this.window = new BrowserWindow(bwOptions) + + if (process.platform === 'linux') { + glasstron.update(this.window, { + linux: {requestBlur: true} + }); + } this.window.once('ready-to-show', () => { if (process.platform === 'darwin') { this.window.setVibrancy('window') @@ -146,6 +150,8 @@ export class Window { } else { DwmEnableBlurBehindWindow(this.window, enabled) } + }else if(process.platform ==="linux"){ + this.window.setBackgroundColor(enabled ? "#00000000" : "#131d27") } else { this.window.setVibrancy(enabled ? 'dark' : null as any) // electron issue 20269 } diff --git a/package.json b/package.json index a9007bc5..b8d77d1e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "eslint-plugin-import": "^2.20.2", "file-loader": "^5.0.2", "graceful-fs": "^4.2.4", + "glasstron": "0.0.3", "html-loader": "0.5.5", "json-loader": "0.5.7", "node-abi": "^2.16.0", diff --git a/terminus-settings/src/components/settingsTab.component.pug b/terminus-settings/src/components/settingsTab.component.pug index 34319559..0e7ce9a1 100644 --- a/terminus-settings/src/components/settingsTab.component.pug +++ b/terminus-settings/src/components/settingsTab.component.pug @@ -52,9 +52,9 @@ ngb-tabset.vertical(type='pills', [activeId]='activeTab') ) | At the bottom - .form-line(*ngIf='hostApp.platform !== Platform.Linux') + .form-line .header - .title(*ngIf='hostApp.platform === Platform.Windows') Acrylic background + .title(*ngIf='hostApp.platform !== Platform.macOS') Acrylic background .title(*ngIf='hostApp.platform === Platform.macOS') Vibrancy .description Gives the window a blurred transparent background From 668986fc0882b282d145793cbfdac8bcfcdbd9cf Mon Sep 17 00:00:00 2001 From: Gwilherm Folliot Date: Thu, 4 Jun 2020 13:34:33 +0200 Subject: [PATCH 2/2] fixed lint --- app/lib/window.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/window.ts b/app/lib/window.ts index 43837eed..40d27f13 100644 --- a/app/lib/window.ts +++ b/app/lib/window.ts @@ -88,8 +88,8 @@ export class Window { if (process.platform === 'linux') { glasstron.update(this.window, { - linux: {requestBlur: true} - }); + linux: { requestBlur: true }, + }) } this.window.once('ready-to-show', () => { if (process.platform === 'darwin') { @@ -150,8 +150,8 @@ export class Window { } else { DwmEnableBlurBehindWindow(this.window, enabled) } - }else if(process.platform ==="linux"){ - this.window.setBackgroundColor(enabled ? "#00000000" : "#131d27") + }else if(process.platform ==='linux'){ + this.window.setBackgroundColor(enabled ? '#00000000' : '#131d27') } else { this.window.setVibrancy(enabled ? 'dark' : null as any) // electron issue 20269 }