You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix the grey line rendered at the top of window on Mojave #15008
Output of node_modules/.bin/electron --version: 3.0.2
Operating System (Platform and Version): macOS 10.14
Output of node_modules/.bin/electron --version on last known working Electron version (if applicable):
Expected Behavior
There should be no grey line rendered at the top of the window area in frameless window.
My conclusion is that Electron uses some obscure combination of window styles that cause this behaviour. I was able to reproduce the same appearance when using Cocoa API in the same fashion on a sample Xcode project.
Actual behavior
On macOS Mojave the grey line is rendered at the top of the window area even when the contents are transparent and the window is configured to be frameless.
( The dark background is the standard wallpaper on Mojave)
Additional Information
Add any other context about the problem here.
Reacted by Michaël Fortin, Seph Soliman, Paulius, Harshyt Goel, Aron Dean Stifani, Laurent Senta, Jonathan Simcoe, Dominique Netters, Jean-Baptiste Meunier, Jordan Muir and 5 more
@pronebird On all platforms frame: false hides the titlebar, not sure exactly what this issue is getting at? Can you explain more what bug / feature you are seeing / looking for here.
@MarshallOfSound on macOS Mojave the one gets the grey line rendered above "hidden" titlebar even if it's entirely transparent, the line is still there. Dropping the NSWindowStyleMaskTitled seems to remedy this.
Reacted by Emrah Bilbay, Michaël Fortin, Aron Dean Stifani, Jordan Muir, Scott Wiedemann and Michael Uvarov
@pronebird I'm still not 100% clear on what the issue you're having is. Can you refill out the issue template but instead of referencing electrons source code describe what isn't currently working and how it should be working.
I think you're experiencing some kind of bug with frameless windows in Mojave but from it's still unclear from your comments.
Also providing a way to reproduce whatever issue you are having would be very useful.
changed the title [-]Add a way to handle the titlebar appearance on macOS[/-][+]Fix the grey line rendered on top of window on Mojave[/+]on Oct 7, 2018
changed the title [-]Fix the grey line rendered on top of window on Mojave[/-][+]Fix the grey line rendered at the top of window on Mojave[/+]on Oct 7, 2018
@MarshallOfSound I've added a test project that you can run to reproduce the issue. Also updated the issue template. Please let me know if you need more information and sorry for starting by mentioning individual lines of code. I was too excited. 😄
All native apps are doing fine except Electron. The problem lays in fact that Electron does not remove the titlebar for frameless windows, but instead hides it. That's why the line is still there. See my investigation above that shows that removing the titlebar solves the mystery.
@lsenta I hate to sound negative about Electron, but looking at the age of this issue which was raised well before the macOS Mojave was released, I don't think it's going to be solved anytime soon.
The best suggestion I can give at this point is to look towards going native for macOS and not depend on a third-party framework like Electron.
All native apps are doing fine except Electron. The problem lays in fact that Electron does not remove the titlebar for frameless windows, but instead hides it. That's why the line is still there. See my investigation above that shows that removing the titlebar solves the mystery.
@pronebird I see now - sorry about the misunderstanding! I depend on Electron since I know nothing about native macOS programming. It's too bad this issue is taking so long since it causes such a bad visual defect and the fix for this specific case appears to be so easy.
As mentioned in #13164, there is a workaround: when creating a BrowserWindow, set titleBarStyle to 'customButtonsOnHover'. I've found that with transparent: true and frame: false this does everything I expected with no grey line, and I'm finding that window operations (setting the location, resizing, opacity changes) appear to be faster using this option.
The downside is that it causes #10424, but I just set a CSS border-radius on what I'm rendering and it's fine. And of course, with customButtonsOnHover, moving the mouse to the upper left corner of the window shows the macOS title bar buttons.
In light of this, my suggestion to @MarshallOfSound and @pronebird is to create a new transparent option to titleBarStyle that does everything customButtonsOnHover does but prevents the buttons from appearing on mouse hover. Does that make sense?
Reacted by Jordan Muir, Xiao呆不糊涂, Andrej Mihajlov and Jonatan Nyqvist
Reacted by Laurent Senta, Blane Townsend, Hugo, Jordan Muir, Andrej Mihajlov and Vince Oveson
@KevinHughes is there a tracking issue for this? I think it's a viable option.
I haven't seen a separate issue for that - if you think it's viable please do make one! I haven't made one since I don't have the ability to test if it's really technically possible or not.
Then just before qutting the app, the one has to make sure to re-enable the closable attribute on window, otherwise the app will never quit, at least on macOS.
window.setClosable(true);
Reacted by Royalone94 and viinaji
Reacted by Johnny Shankman
Reacted by Jordan Muir, Lanistor, Hugo, Royalone94, Kyle Chilcutt, Xianqiao Wang, Gustavo Garcia and Mohamed Sofi
Activity
MarshallOfSound commentedon Oct 7, 2018
@pronebird On all platforms
frame: falsehides the titlebar, not sure exactly what this issue is getting at? Can you explain more what bug / feature you are seeing / looking for here.pronebird commentedon Oct 7, 2018
@MarshallOfSound on macOS Mojave the one gets the grey line rendered above "hidden" titlebar even if it's entirely transparent, the line is still there. Dropping the
NSWindowStyleMaskTitledseems to remedy this.pronebird commentedon Oct 7, 2018
I have tested my assumption on a new Xcode project and it seems that the combination of flags that Electron uses is not desirable.
I was able to reproduce this by setting the following window configuration (which is pretty much what Electron does):
Dropping the
.titledstyle essentially removes the titlebar instead of making it button-less and transparent.window.backgroundColor = NSColor.clear window.isOpaque = false let defaultStyle: NSWindow.StyleMask = [.borderless] -window.titleVisibility = .hidden window.titlebarAppearsTransparent = true window.styleMask = defaultStyleWhich works as expected:
MarshallOfSound commentedon Oct 7, 2018
@pronebird I'm still not 100% clear on what the issue you're having is. Can you refill out the issue template but instead of referencing electrons source code describe what isn't currently working and how it should be working.
I think you're experiencing some kind of bug with frameless windows in Mojave but from it's still unclear from your comments.
Also providing a way to reproduce whatever issue you are having would be very useful.
[-]Add a way to handle the titlebar appearance on macOS[/-][+]Fix the grey line rendered on top of window on Mojave[/+][-]Fix the grey line rendered on top of window on Mojave[/-][+]Fix the grey line rendered at the top of window on Mojave[/+]pronebird commentedon Oct 7, 2018
@MarshallOfSound I've added a test project that you can run to reproduce the issue. Also updated the issue template. Please let me know if you need more information and sorry for starting by mentioning individual lines of code. I was too excited. 😄
garshythoel commentedon Oct 11, 2018
laurentsenta commentedon Nov 19, 2018
Hi there, thanks for maintaining Electron. And thanks for taking care of detailing the issue @pronebird !
I'm waiting for a fix to release my app and it may be worth for me to figure out a workaround.
Could you share a rough timeline?
pronebird commentedon Nov 21, 2018
@KevinHughes please do not spread fake news.
All native apps are doing fine except Electron. The problem lays in fact that Electron does not remove the titlebar for frameless windows, but instead hides it. That's why the line is still there. See my investigation above that shows that removing the titlebar solves the mystery.
@lsenta I hate to sound negative about Electron, but looking at the age of this issue which was raised well before the macOS Mojave was released, I don't think it's going to be solved anytime soon.
The best suggestion I can give at this point is to look towards going native for macOS and not depend on a third-party framework like Electron.
KevinHughes commentedon Nov 21, 2018
@pronebird I see now - sorry about the misunderstanding! I depend on Electron since I know nothing about native macOS programming. It's too bad this issue is taking so long since it causes such a bad visual defect and the fix for this specific case appears to be so easy.
floating commentedon Jan 9, 2019
Has there been any progress on this?
KevinHughes commentedon Feb 2, 2019
As mentioned in #13164, there is a workaround: when creating a
BrowserWindow, settitleBarStyleto'customButtonsOnHover'. I've found that withtransparent: trueandframe: falsethis does everything I expected with no grey line, and I'm finding that window operations (setting the location, resizing, opacity changes) appear to be faster using this option.The downside is that it causes #10424, but I just set a CSS
border-radiuson what I'm rendering and it's fine. And of course, withcustomButtonsOnHover, moving the mouse to the upper left corner of the window shows the macOS title bar buttons.In light of this, my suggestion to @MarshallOfSound and @pronebird is to create a new
transparentoption totitleBarStylethat does everythingcustomButtonsOnHoverdoes but prevents the buttons from appearing on mouse hover. Does that make sense?floating commentedon Feb 12, 2019
👍 Definitely would like a solution for this!
MarshallOfSound commentedon Feb 12, 2019
Didn't realize this was open, closing as duplicate of #13164
See #13164 (comment) for final comments
pronebird commentedon May 20, 2019
@KevinHughes is there a tracking issue for this? I think it's a viable option.
KevinHughes commentedon May 23, 2019
I haven't seen a separate issue for that - if you think it's viable please do make one! I haven't made one since I don't have the ability to test if it's really technically possible or not.
pronebird commentedon May 30, 2019
Since 6.0.0-beta.5 it's possible to fix this issue by using the following window configuration:
Then just before qutting the app, the one has to make sure to re-enable the
closableattribute on window, otherwise the app will never quit, at least on macOS.