GregVido / mica-electron

Library to add mica effect of windows 11 in electron app
Apache License 2.0
126 stars 7 forks source link

frame: false doesn't remove the titlebar's background color #32

Open iuriineves opened 6 months ago

iuriineves commented 6 months ago

Description

Setting frame: false on the MicaBrowserWindow options doesn't not get rid of the background color the title bar has.

Changing the titlebar's color using win.setCaptionColor() does change the color of the little "strip", which indicates it is indeed the titlebar.

This issue is very similar to (if not the same as) issue #13. Changing the system setting "Show accent color on title bars and windows borders" seems to fix the issue, might look into that.

Screenshots

Expected

image

Actual Result

image

To Reproduce

Create a MicaBrowserWindows with the setting frame: false while having the system setting "Show accent color on title bars and windows borders" turned on.

GregVido commented 6 months ago

I need to figure out how to do it on Windows but at the moment I don't have much time :/

iuriineves commented 6 months ago

No worries, take your time with it. Turning off the setting "Show accent color on title bars and windows borders" does seem to get rid of it, maybe the color is acting on the window itself instead of the titlebar?

image

iuriineves commented 6 months ago

Update!

After extensive tinkering with mica-electron yesterday, I made some interesting discoveries.

In the main.js file, setting the BrowserWindow to transparent seemed to resolve the initial issue. However, this change exposed several other problems, such as the absence of animations and square corners.

To my surprise, Windows updated itself last night, seemingly resolving the issue on its own. While I'm uncertain about the exact fix, a cumulative update appeared to have addressed the problem automatically.

Now, what I've noticed in the main.js file is that the following code disrupts animations:

if (IS_ELECTRON_BETA)
    args[0].transparent = true; //Line 195

Initially, this line appeared to fix some issues after updating Electron to a newer version. However, after the recent Windows update, it seems this line is no longer necessary. I'll investigate any potential side effects it may be causing. If none are found, I'll proceed with submitting a PR.

Have a great day!

image

(The app now working, even with "Show accent color on title bars and windows borders" turned on)