pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

src: Allow windows to be transparent, behind a pref (off by default)

Open DeeDeeG opened this issue 1 year ago • 4 comments

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.)

Transparent_Pulsar_window_with_several_panes_and_tabs_open_entire_window_is_semi-see-through_and_a_TextEdit_window_is_visible_behind_Pulsar Transparent_Pulsar_window_with_several_panes_and_tabs_open_entire_window_is_semi-see-through

Release Notes

Add a preference core.allowWindowTransparency so that themes and user stylesheets can make editor windows' backgrounds transparent.

DeeDeeG avatar Apr 18 '24 20:04 DeeDeeG

The test failure here was spurious (known flaky test) but this'll need a rebase against latest master for CI to start working again.

savetheclocktower avatar May 06 '24 20:05 savetheclocktower

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!

DeeDeeG avatar May 08 '24 22:05 DeeDeeG

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.

DeeDeeG avatar May 15 '24 04:05 DeeDeeG

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.

savetheclocktower avatar May 15 '24 05:05 savetheclocktower

Thanks for the review!

DeeDeeG avatar Jun 15 '24 22:06 DeeDeeG