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
Many Electron apps should be low-hanging fruit, because they already use CSD on macOS (e.g. Slack).
This likely means very little work would be required on the application side to make this happen on GNU/Linux as well.
However, since some additional complexity is required in order to get the proper GNOME CSD behavior (respecting gsettings etc.), some of this should probably be supported by Electron directly. That would be easier for Electron app developers and make for more consistent behavior.
We should first work with upstream Electron to add GNOME-style CSD support at a platform level. Once that is in place, we can start approaching individual app developers.
Reacted by Shubham Arora, Sergey Bugaev, Owais Lone, eyelash, Chris, Maël Lavault, palob, Guillaume AMAT, Deri Herdianto, Robert Washbourne and 82 more
Reacted by Frederik Feichtmeier, Hendry Sadrak, Max Vincent Goldgamer, Jay Roldán Ruiz and bhack
Reacted by Salva Corts, Frederik Feichtmeier, Caesar Schinas, LEN, raul75sh, Linus Groh, Jake Jarrett, Teoh Han Hui, Hendry Sadrak, Red J Adaya and 10 more
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
This would be very helpful in Ubuntu since the latest re-introduction of the GNOME shell as the default desktop environment, because in GNOME shell there is no easy way (yes, there are extensions that can be installed) to merge the titlebar of windows with the shell's panel! This would save screenspace and would follow the latest UI trends :)
Reacted by Caesar Schinas, Ingwie Phoenix, Fabian Bornschein, rockiger, COREBOTS, Steffen Bruchmann, Fathy AR, Teoh Han Hui, Golovin Ilia, Hashem Nasarat and 4 more
Please add CSD support for Electron apps on GNOME. There are so many nice Electron apps and they all still use the old titlebar :( Imagine the bomb exploding when Electron apps suddenly look like native GNOME ones :)
Reacted by Teoh Han Hui, Michael Ditto , Hendrich Attila, Hendry Sadrak, Mulud At Saadi, orlando-oli, Golovin Ilia, Rael Gugelmin Cunha, Andrii Oriekhov, fwcd and 7 more
Reacted by Teoh Han Hui and Nelson Lopez
Reacted by Golovin Ilia, Nelson Lopez, Pedro Fleck, S.Palmer and Patrick Wicki
Visual Studio Code has been using CSD for like a year on Linux so its clearly possible. It just requires the application manually opt-in for some reason.
Reacted by Teoh Han Hui, Hashem Nasarat and zaguragit
A quick proof of concept made of GTK4 WebKit minibrowser:
The top bar is draggable, has context menu etc. However, that area of the web page does not pass any events to the web page, i.e. cannot be clicked other than for window actions, cannot be scrolled etc.
Reacted by Pedro Fleck, Frederik Feichtmeier, Marvin Hagemeister, Tadej Janež, Michael, Rohan Mishra, Michael Ditto , Jhagas Hana Winaya, zaguragit, Andrii Oriekhov and 1 more
Given that this is almost sine qua non for Wayland, I have opened an FR #27522. Only later I found out this issue which AFAICS has been disconnected from recent developments in Electron towards Wayland support. I don't know which is the best way to proceed: leaving my Wayland specific FR as part of the Wayland support initiative, leaving this more general one open, leaving both open.
I'm interested in exploring the approach suggested by @Exalm here #11907 (comment).
Some questions though:
If this were a plausible solution, would it imply full migration of Electron to GTK4?
Would that be too hard or even acceptable?
Regarding the second question, for me the relevant time horizon is tied to Wayland support, so it's clearly not next month but, at best, next year (I'm an optimist). In that light, GTK4 seems less unreasonable.
Too hard in what sense? It's just a bit of widgetry. Of course you'd also need API to control it, but it already works this way on macOS, so..
I meant porting Electron to GTK4, not GTK4 per se. I don't know how much of GTK is there in Electron, I assume it's just a scaffolding bit but it's all guessing at this point for me.
Ah, and also:
Being GTK4 controls, would this be supported out of the box by Plasma GTK CSD integration? Anyone knows?
Here the main widget is a button, not a webview, but I think that's good enough for a POC. Even though I think it's not that bad, I sort of dislike the idea that every release is passed to the underlying button as a click, I would like to differentiate between single and double clicks, but I don't know of a way to separate them other than waiting for a fraction of second to the second click (n_press = 2).
Moreover, I don't know if the only event we want to forward is a single click, probably it is but I will have to understand how this is managed by Electron for other platforms first.
Apart from how to do this GTK side, it seems to me that it would be hard to implement Electron side. AFAICS there is no GTK window to which simply set the overlay as content, but windows come from deep into the aura/ozone layers and have nothing GTK in them. For the MacOS case the entire NativeWindow was reimplemented, look at the header file to get an idea about how many methods were overridden, then a WindowButtonsView was introduced into the window. I might be plain wrong, but I suspect something like that should be done for Linux in order to introduce the overlay, handle and buttons.
@memeplex unfortunately im not to familiar with how electron windows work but you seem to be right. After spending a few hours in there trying to understand it, it seems that to have native headerbars from gtk, it would need huge amount of rework to get those gtk components on screen. And given that most apps dont even bother having client side decorations on linux (slack, discord, etc all use system provided bars, vscode gives an option but it is rather basic and doesnt follow system convention.) it seems unlikely anyone would bother implementing it for gtk/linux. The next best thing would be to allow apps to read the window button configuration (position, options, actual button assets) which would allow apps to use their CSD and still follow somewhat follow the system convention. This is an OK option since usability wise, we are matching the button layout and gnome HIG is open to apps using their style as long as they follow some basic conventions.
@harmathy I'm guessing it wasn't enabled by default because it's experimental and has the potential to be broken? To my understanding, this issue is just about having the feature in Electron and not about making sure that it's bug-free or enabled by default.
Since we have an open issue tracking the bug you mentioned already, what do you think about continuing the discussion there / creating newer issues if more bugs are found? FWIW, the PR author mentioned that they'll take a look at the issue you shared - #34820 (comment).
Reacted by Max Harmathy, Eric Engestrom and Andrii Oriekhov
Activity
welcome commentedon Feb 13, 2018
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
bugaevc commentedon Feb 13, 2018
Also related: atom/atom#13249, atom/atom#4599.
For Atom's titlebar implementation for macOS see atom/atom#13616
felixrieseberg commentedon Feb 14, 2018
Solid idea. The usual open source rules apply: If you build it, developers might use it.
TingPing commentedon Mar 16, 2018
Dumb question but this seems to work fine on Linux: https://github.com/electron/electron/blob/master/docs/api/frameless-window.md
So what is actually needed for applications to use CSD? What method is commonly used to enable it?
EDIT: Ah
titleBarStyleonly seems to work on OSX.ZanderBrown commentedon Jun 12, 2018
Also relevant microsoft/vscode#43154
Feichtmeier commentedon Jun 29, 2018
This would be very helpful in Ubuntu since the latest re-introduction of the GNOME shell as the default desktop environment, because in GNOME shell there is no easy way (yes, there are extensions that can be installed) to merge the titlebar of windows with the shell's panel! This would save screenspace and would follow the latest UI trends :)
corebots commentedon Aug 29, 2019
Please add CSD support for Electron apps on GNOME. There are so many nice Electron apps and they all still use the old titlebar :( Imagine the bomb exploding when Electron apps suddenly look like native GNOME ones :)
mld9401 commentedon Mar 27, 2020
Please add CSD support on Linux
TheGreatHalva commentedon Apr 2, 2020
Now that KDE supports headerbars too, there's even more reason to do it.
TingPing commentedon Apr 2, 2020
Visual Studio Code has been using CSD for like a year on Linux so its clearly possible. It just requires the application manually opt-in for some reason.
teohhanhui commentedon Apr 2, 2020
That's a custom implementation that doesn't respect the native look and feel.
50 remaining items
alice-mkh commentedon Dec 10, 2020
Passthrough is kinda implicit in GTK, but I don't know for sure if specifically window handle would block it.
alice-mkh commentedon Dec 12, 2020
A quick proof of concept made of GTK4 WebKit minibrowser:
The top bar is draggable, has context menu etc. However, that area of the web page does not pass any events to the web page, i.e. cannot be clicked other than for window actions, cannot be scrolled etc.
memeplex commentedon Jan 27, 2021
Given that this is almost sine qua non for Wayland, I have opened an FR #27522. Only later I found out this issue which AFAICS has been disconnected from recent developments in Electron towards Wayland support. I don't know which is the best way to proceed: leaving my Wayland specific FR as part of the Wayland support initiative, leaving this more general one open, leaving both open.
memeplex commentedon Jan 27, 2021
I'm interested in exploring the approach suggested by @Exalm here #11907 (comment).
Some questions though:
Regarding the second question, for me the relevant time horizon is tied to Wayland support, so it's clearly not next month but, at best, next year (I'm an optimist). In that light, GTK4 seems less unreasonable.
alice-mkh commentedon Jan 27, 2021
Yes, that's GTK4.
Too hard in what sense? It's just a bit of widgetry. Of course you'd also need API to control it, but it already works this way on macOS, so...
memeplex commentedon Jan 27, 2021
I meant porting Electron to GTK4, not GTK4 per se. I don't know how much of GTK is there in Electron, I assume it's just a scaffolding bit but it's all guessing at this point for me.
Ah, and also:
memeplex commentedon Jan 30, 2021
@Exalm
GtkWindowHandledoesn't pass clicks through, but I managed to get it somehow working with a custom gesture controller:Here the main widget is a button, not a webview, but I think that's good enough for a POC. Even though I think it's not that bad, I sort of dislike the idea that every release is passed to the underlying button as a click, I would like to differentiate between single and double clicks, but I don't know of a way to separate them other than waiting for a fraction of second to the second click (n_press = 2).
Moreover, I don't know if the only event we want to forward is a single click, probably it is but I will have to understand how this is managed by Electron for other platforms first.
memeplex commentedon Jan 31, 2021
Apart from how to do this GTK side, it seems to me that it would be hard to implement Electron side. AFAICS there is no GTK window to which simply set the overlay as content, but windows come from deep into the aura/ozone layers and have nothing GTK in them. For the MacOS case the entire
NativeWindowwas reimplemented, look at the header file to get an idea about how many methods were overridden, then a WindowButtonsView was introduced into the window. I might be plain wrong, but I suspect something like that should be done for Linux in order to introduce the overlay, handle and buttons.Could someone more savvy take a look at this?
stalkerg commentedon Mar 16, 2021
What about KDE/Plasma integration? I mean I hope the Electron will not depend on GTK much.
rohmishra commentedon May 23, 2021
@memeplex unfortunately im not to familiar with how electron windows work but you seem to be right. After spending a few hours in there trying to understand it, it seems that to have native headerbars from gtk, it would need huge amount of rework to get those gtk components on screen. And given that most apps dont even bother having client side decorations on linux (slack, discord, etc all use system provided bars, vscode gives an option but it is rather basic and doesnt follow system convention.) it seems unlikely anyone would bother implementing it for gtk/linux. The next best thing would be to allow apps to read the window button configuration (position, options, actual button assets) which would allow apps to use their CSD and still follow somewhat follow the system convention. This is an OK option since usability wise, we are matching the button layout and gnome HIG is open to apps using their style as long as they follow some basic conventions.
RaisinTen commentedon Jul 15, 2022
@1j01 #29618 has landed already. Can we close this issue now?
harmathy commentedon Jul 15, 2022
@RaisinTen The problem is, that it is not enabled by default and utterly broken (#34820)
RaisinTen commentedon Jul 15, 2022
@harmathy I'm guessing it wasn't enabled by default because it's experimental and has the potential to be broken? To my understanding, this issue is just about having the feature in Electron and not about making sure that it's bug-free or enabled by default.
Since we have an open issue tracking the bug you mentioned already, what do you think about continuing the discussion there / creating newer issues if more bugs are found? FWIW, the PR author mentioned that they'll take a look at the issue you shared - #34820 (comment).
RaisinTen commentedon Jul 18, 2022
I see there are few PRs up already, attempting to fix that bug. Closing this issue for now, thank you all for the feature request!