From 6220705884ccee5905f6d91ddb4e6cd239ab6cd3 Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Thu, 18 Apr 2024 00:29:35 -0400 Subject: [PATCH] src: Allow windows to be transparent, behind a pref (off by default) Add a `core.allowWindowTransparency` pref (off by default). Sets `options.transparent = true` for the `browserWindow` `options` when this pref is enabled. Requires a restart to activate. Co-credit to savetheclocktower for the revised description of the pref. Co-authored-by: Andrew Dupont --- src/config-schema.js | 6 ++++++ src/main-process/atom-application.js | 3 +++ src/main-process/atom-window.js | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/config-schema.js b/src/config-schema.js index fd038634f9..ab667c9177 100644 --- a/src/config-schema.js +++ b/src/config-schema.js @@ -399,6 +399,12 @@ const configSchema = { description: 'Add the current tab title to the Pulsar Window title.', type: 'boolean', default: true + }, + allowWindowTransparency: { + type: 'boolean', + default: false, + title: 'Allow Window Transparency', + description: `Allows editor windows to be see-through. When this setting is enabled, UI themes and user stylesheets can use background colors with an alpha channel to make editor windows translucent. Takes effect after a restart of Pulsar.` } } }, diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index a42b566980..31254c3066 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -285,6 +285,9 @@ module.exports = class AtomApplication extends EventEmitter { this.config.onDidChange('core.colorProfile', () => this.promptForRestart() ); + this.config.onDidChange('core.allowWindowTransparency', () => + this.promptForRestart() + ); }); await this.configFilePromise; } diff --git a/src/main-process/atom-window.js b/src/main-process/atom-window.js index 4343124b6b..f5e242da51 100644 --- a/src/main-process/atom-window.js +++ b/src/main-process/atom-window.js @@ -80,6 +80,10 @@ module.exports = class AtomWindow extends EventEmitter { options.titleBarStyle = 'hiddenInset'; if (this.shouldHideTitleBar()) options.frame = false; + if(this.atomApplication.config.get('core.allowWindowTransparency')){ + options.transparent = true; + } + const BrowserWindowConstructor = settings.browserWindowConstructor || BrowserWindow; this.browserWindow = new BrowserWindowConstructor(options);