Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Support full frame transparency with Mica background material #38532

Closed
3 tasks done
samuelmaddock opened this issue May 31, 2023 · 5 comments · Fixed by #39708
Closed
3 tasks done

Comments

@samuelmaddock
Copy link
Member

samuelmaddock commented May 31, 2023

Preflight Checklist

Problem Description

The Mica backgroundMaterial effect does not appear below the WebContents.

Proposed Solution

The backgroundMaterial option should behave the same as when setting the vibrancy option.

macOS: vibrancy: 'medium-light' Windows: backgroundMaterial: 'acrylic' Windows: backgroundMaterial: 'acrylic' + transparent: true
Screenshot 2023-05-31 at 4 30 04 PM image (5) image (6)

When vibrancy is set, the WebContents is transparent by default. The same should apply to backgroundMaterial. Setting transparent: true doesn't seem to be a valid workaround, but ideally should still work.

The code below needs to be updated:

} else if (!vibrancy_type.empty() || transparent) {
// If the BrowserWindow is transparent or a vibrancy type has been set,
// also propagate transparency to the WebContents unless a separate
// backgroundColor has been set.
web_preferences.SetHidden(options::kBackgroundColor,
ToRGBAHex(SK_ColorTRANSPARENT));
}

Alternatives Considered

None.

Additional Information

Tested on:

Edition	Windows 11 Pro
Version	22H2
OS build	22621.1778

Fiddle gist: https://gist.github.com/34cf667b21a5075d1f6fbe093d7ad7f9

@michalzaq12
Copy link
Contributor

backgroundMaterial works well with transparent: true, but window cannot be frameless

@ttnn5876
Copy link

backgroundMaterial works well with transparent: true, but window cannot be frameless

Do you know why it works like this?

@clavin clavin self-assigned this Jun 14, 2023
@clavin
Copy link
Member

clavin commented Jun 15, 2023

I've been looking into this and I've discovered that something about the remove_standard_frame option in views is causing the background to be non-translucent. Still investigating...

@clavin
Copy link
Member

clavin commented Jun 15, 2023

This is what I have on my clavin/frameless-bg-mat branch with remove_standard_frame set to false:

A window with the acrylic background material, but

Obviously, it has a frame, which is not great, but turning on the option causes the window to no longer be translucent, strangely. Still, it's progress 😄

@clavin
Copy link
Member

clavin commented Jun 27, 2023

I fiddled around more with this issue and I unfortunately am going to have to drop it for the time being.

Since I wasn't getting any traction modifying Electron & Chromium, I decided to try to see if making a window like this was even possible. In the end, I wasn't able to create a window that has no title bar (window title, controls, bg), but does have a frame (the rounded corners and resizable border around the window) while also applying the Mica or Acrylic window effects.

In my research I saw some possible WinRT solutions. I skipped these for the time being as I sensed they may require a bit of a refactor in Electron to get working.

Also, I didn't come across any code samples that demonstrate how to crate the type of window desired here. I did see some mentions that it is possible, but ultimately no proof or demonstration. 😕

Within Windows 11, I did notice that the Task Manager's performance charts have a detail mode that collapses the window (including the title bar!) to only show the chosen chart. This makes me think it is somehow possible, but unfortunately I don't quite know how to recreate the behavior.

@clavin clavin removed their assignment Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants