Skip to content

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

Closed

Description

@samuelmaddock

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

Activity

  1. michalzaq12 commented on Jun 1, 2023

    @michalzaq12
    Contributor

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

  2. LITzman commented on Jun 13, 2023

    @LITzman

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

    Do you know why it works like this?

  3. self-assigned this
    on Jun 14, 2023
  4. clavin commented on Jun 15, 2023

    @clavin
    Member

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

  5. clavin commented on Jun 15, 2023

    @clavin
    Member

    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 😄

  6. clavin commented on Jun 27, 2023

    @clavin
    Member

    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.

  7. removed their assignment
    on Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions