Skip to content

'backgroundMaterial' is not work in frameless window #38466

Closed

Description

@aleversn

Preflight Checklist

Electron Version

24.4.0

What operating system are you using?

Windows

Operating System Version

Windows 11 22H2

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

The feature of backgroundMaterial could work on frameless window, or it can work when the titleBarStyle is hidden.

Actual Behavior

The feature of backgroundMaterial is not work when set frame: false or titleBarStyle: hidden.

Testcase Gist URL

No response

Additional Information

No response

Activity

  1. Bhavyaatrivedi commented on May 28, 2023

    @Bhavyaatrivedi

    Hi, I want to work on this issue.

  2. Bhavyaatrivedi commented on May 28, 2023

    @Bhavyaatrivedi

    Can you provide me with the path of file where the issue has been observed.

  3. aleversn commented on May 28, 2023

    @aleversn
    Author

    Can you provide me with the path of file where the issue has been observed.

    Sure, you can try this repo https://github.com/Creator-SN/VFluentForElectron

    In the background.js (https://github.com/Creator-SN/VFluentForElectron/blob/master/src/background.js), there is the BrowserWindow

    the feature can only work when the frame: true and the window should be transparent:

    const win = new BrowserWindow({
            frame: true,
            width: 800,
            height: 600,
            transparent: true,
            backgroundMaterial: "acrylic",
            webPreferences: {
                enableRemoteModule: true,
                // Use pluginOptions.nodeIntegration, leave this alone
                // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
                nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
                contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
                devTools: true
            }
        })

    And there is another concern that when both frame and transparent are set true, the maximize button turns disabled.

  4. Bhavyaatrivedi commented on May 29, 2023

    @Bhavyaatrivedi

    The issue is that the frame option cannot be both true and false at the same time. You can either set frame to true and remove the transparent option, or set frame to false and add the transparent option. Which option you choose will depend on your specific needs.
    When both frame and transparent are set to true, the maximize button is disabled because the window cannot be maximized if it does not have a frame. The maximize button is used to maximize a window, which means to make it fill the entire screen. If a window does not have a frame, it cannot be maximized because there is no border to stretch to the edges of the screen.

    There are a few ways to work around this issue. One way is to set frame to false and then use the Window.setMaximized() method to manually maximize the window.

  5. aleversn commented on May 29, 2023

    @aleversn
    Author

    This seems to be a solution to maximize the window, but when transparent is false, the backgroundMaterial can be only seen in the title bar. And I think it would be best to enable the backgroundMaterial when the frame is false, so that I can use the customized title bar.

  6. moved this to Unsorted Items in 24-x-yon Jun 5, 2023
  7. added
    has-repro-repo
    on Jun 5, 2023
  8. electron-issue-triage commented on Sep 4, 2023

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  9. JellyBrick commented on Sep 29, 2023

    @JellyBrick

    still does not work on v27.0.0-beta.8.
    I want to apply the backgroundMaterial while keeping the shadow and maximization feature, but without enabling transparent, the backgroundMaterial won't be applied.

  10. 24 remaining items

  11. moved this to 👀 Unsorted Items in 36-x-yon Apr 16, 2025
  12. moved this to 👀 Unsorted Items in 35-x-yon Apr 16, 2025
  13. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 35-x-yon Apr 16, 2025
  14. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 36-x-yon Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

34-x-y35-x-y36-x-ybug 🪲component/BrowserWindowhas-repro-repo

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions