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 <github@andrewdupont.net>
This commit is contained in:
DeeDeeG 2024-04-18 00:29:35 -04:00
parent a6fe2bcf3c
commit 6220705884
3 changed files with 13 additions and 0 deletions

View File

@ -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.`
}
}
},

View File

@ -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;
}

View File

@ -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);