seo-rii / electron-acrylic-window

Add acrylic effect to your electron application
MIT License
279 stars 23 forks source link

The transparent effect is apply to title bar when mainWindow show after apply the effect #82

Open Naozumi520 opened 2 years ago

Naozumi520 commented 2 years ago

As the title say, the transparent effect will also apply to the title bar when mainWindow show after apply the effect: image

Here's a part my code:

let window;
window = new BrowserWindow({
        title: 'Test',
        icon: './public/img/favicon.ico',
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false,
            backgroundThrottling: false,
            devTools: false
        },
        resizable: true,
        width: 1000,
        height: 600,
        show: false
    });

setVibrancy before showing window, the title bar will become transparent but the background still white and it just being blurry :

            setVibrancy(window, { effect: 'acrylic', disableOnBlur: true })
            window.show();
        }
    });

show the window before setVibrancy fix the issue, but I use did-finish-load as I hope the window only appear when all the component are fully loaded and this break the rules : image

Initialize_view.webContents.on('did-finish-load', () => {
            window.show();
            setVibrancy(window, { effect: 'acrylic', disableOnBlur: true })
        }
    });
}