src: Allow windows to be transparent, behind a pref (off by default)
Issue or RFC Endorsed by Pulsar's Maintainers
resolves https://github.com/pulsar-edit/pulsar/issues/948.
Was discussed in the issue above, and further discussed on Discord:
- https://discord.com/channels/992103415163396136/992109539346370661/1223052096803438693
- https://discord.com/channels/992103415163396136/1230350567176405053
Description of the Change
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.
Alternate Designs
Could put this on by default, or even always on without a pref to control it. I wanted it off by default just to be on the cautious side about it, in case it breaks the app / its rendering for somebody out there, or perhaps there is some perf hit (not investigated).
Could not implement the requested transparency mode at all, but this seems low-stakes enough behind a pref that's off by default, kind of a "why not?" thing at this point.
Could make the pref not prompt for restart when editing it in the settings-view UI, but... why not prompt for restart? (I think we do poll the preferences very frequently, and there is a listener for changes to certain prefs at which point it will prompt for a restart, but that is an existing pattern. If it's worth revisiting that for performance or wanting to reduce I/O, we can revisit that separately?)
Possible Drawbacks
None that I know of.
Verification Process
Tested, worked for me on macOS. (Kind of weird-looking with the CSS the original guide provided, but if this is what people are requesting, this is it. You can indeed see the apps/desktop behind it. Maybe enabling this situationally like when the editor is not focused would make sense. Theme authors and user stylesheet authors have lots of freedom to do whatever they want with it.)
(Note that the lack of a frame (window title bar) in these screenshots is technically unrelated. At the time I took these screenshots, I had set some options to disable the frame per the atom-transparency guide, but that option has been made its own pref since the original atom-transparency guide was published, so lack of window titlebar/"frame" is not part of this PR. Folks following that old guide can now use the separate, existing core.titleBar pref to control that.)
Release Notes
Add a preference core.allowWindowTransparency so that themes and user stylesheets can make editor windows' backgrounds transparent.
The test failure here was spurious (known flaky test) but this'll need a rebase against latest master for CI to start working again.
Turns out the "package tests" workflow is Linux-only, so we don't need the "pin to macOS 12" fix here. The only jobs needing re-runs were on Linux exclusively.
CI is passing/green now!
Should I re-do the implementation to match the others, per https://github.com/pulsar-edit/pulsar/pull/982#discussion_r1571898572?
Or is this good to go now that CI is green/passing?
(If it makes sense to "re-enable all the things [during specs]", then I suppose that could be punted to another PR. In favor of that would be uniformity. Against that would be the argument that such a follow-up PR is low-stakes enough to probably not justify the effort, so it may not happen.
Should I re-do the implementation to match the others, per #982 (comment)?
Or is this good to go now that CI is green/passing?
It's up to you. Was a suggestion, but certainly not a blocker.
Thanks for the review!