Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
In Wayland clients usually render their own decorations, they don't get SSD anymore (although there seems to be a protocol for SSD negotiation that Plasma and some compositors based on wlroots implement). The Wayland build is not very useful until Electron app windows get a proper headerbar. The headerbar can be a stock headerbar similar to old-school SSD or can be customized by the app (for example, by setting its color/theme in accordance with the app contents).
Proposed Solution
Use GTK CSD support, which is also well-integrated in Qt-based environments (mainly Plasma):
void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar, gboolean setting);
Sets whether this header bar shows the standard window decorations, including close, maximize, and minimize.
“gtk-decoration-layout” char *
This setting determines which buttons should be put in the titlebar of client-side decorated windows, and whether they should be placed at the left of right.
Alternatives Considered
It doesn't seem to exist much more alternatives. Maybe Qt has a native headerbar implementation, but it won't properly work inside a GTK-based environment like GNOME, while it works the other way around. See https://pointieststick.com/2019/11/30/this-week-in-kde-gtk-csd-support-and-more
Maybe xdg-decoration as suggested in some comments below. But I ignore everything about it and SSD doesn't seem to me the best alternative for Electron apps that tend to be more app-centric than platform-centric by its very nature and so, at least in major platforms, usually customize headerbars.
Additional Information
More details in discussion starting from #10915 (comment)
Activity
Xyene commentedon Jan 27, 2021
Leaving aside the meat of this request, I did want to point out one misconception:
This is not true.
There exists a protocol (
xdg-decoration) that at least KDE and Sway/wlroots implement, allowing negotiation of SSDs. What is true is that GNOME have made it very clear they will not implement this protocol, such that applications wishing to have decorations on GNOME must implement CSDs.See:
ckerr commentedon Jan 27, 2021
Thanks for the suggestion!
I know the Electron project would be very happy to have better Wayland support but I don't think there is anyone on the project actively working on this right now. If anyone in the community wants to contribute work to this, I for one would be very happy about that.
ZanderBrown commentedon Jan 27, 2021
An unstable optional/extension protocol which even states that a valid
xdg-decorationimplementation doesn't actually have to support SSD, so whilst it may be something electron is interested in it is not the solution you are looking for as even whenxdg-decorationis present (and at least on GNOME it isn't) it may not do anythingmemeplex commentedon Jan 27, 2021
I didn't know about xdg-decoration, I edited the description to account for this. Thank you.
Xyene commentedon Jan 27, 2021
Yes, agreed, I was only pointing out against the (probably unintentional) absolutist "there are no SSDs [in Wayland]" (emphasis mine). There is an extension for negotiating SSDs that KDE and wlroots implement. It's not supported by GNOME. Electron doesn't strictly use core Wayland protocols. Leaving aside personal opinions on the matter, this is the current state of decorations on Wayland :)
Note that KDE's Wayland support isn't based on wlroots :)
memeplex commentedon Jan 27, 2021
I remember having read the post by Tobias @Xyene linked at the time, I mean https://blogs.gnome.org/tbernard/2018/01/26/csd-initiative/. Rereading it now I realize Electron was mentioned as a potentially easy case:
ZanderBrown commentedon Jan 27, 2021
Note Tobias made that comment from the perspective of app developers using it, not electron providing it
memeplex commentedon Jan 27, 2021
Yes, that's true, but I assume that the fact that apps are doing this in MacOS, combining their own widgets with platform provided ones in a coherent way, means that the abstractions are right there in Electron and we need to implement them, not define them. I ignore everything about Electron, TBH, so I'm going to take a look later.
christianrauch commentedon Mar 4, 2021
Just want to add here that
libdecorcould be used specifically to implement client-side decorations under Wayland.stalkerg commentedon Mar 16, 2021
@christianrauch I can't see any much activities there it looks like a prototype. Also, it does not support Enignlement.
christianrauch commentedon Mar 16, 2021
What activity would you expect?
libdecoris a library that only implements window decorations, nothing more. If you need a specific feature, you can open an issue and we can review how feasible this is.I hereby officially invite you to become active in the project :-)
What is "Enignlement"? Is it an application? If the decorations don't work as expected with your application then please open an issue so we can review if this is an issue with
libdecoror the client application.jokeyrhyme commentedon Mar 16, 2021
Possibly a reference to the Enlightenment desktop/compositor, which does support client-side decorations in wayland: https://www.enlightenment.org/about-wayland
rohmishra commentedon Mar 19, 2021
I'm looking for clarification and also take this with a grain of salt since it's been a while since I last worked on anything electron but:
AFAIR the buttons used in mac and windows were a bit more bespoke/custom than they looked because since windows & mac both are one singe platforms we knew where the buttons had to be and how they looked so apps just implemented buttons looking like that (and I guess on mac you can request the system to draw the buttons for you). But for true CSD support on Linux it's not that simple because on Linux you can configure where you want the buttons, which buttons do you want and how the buttons look. So for true CSD the apps need to implement a way to handle button arrangement so that it follows the system style (left/right, which buttons) and either devise a way to make sure current button style looks good/usable with their app theme or just use custom assets for the icon.
Which leads me to my conclusion/questions/clarification:
gtk-decoration-layouteasily. But once apps can read that, apps can replicate (with a bit or rework and code sharing between Linux left side decoration/mac and right side/windows) button layout and apps should feel more in line with native apps as far as layout goes. (Or is it possible just never done?)WhyNotHugo commentedon Mar 19, 2021
@rohmishra You are correct.
In reality, Server Side Decorations are the simplest way to implement thing for developers: applications will be drawn with buttons (and everything else) in whichever way the user configured it in whatever desktop they may be using. It's what works almost everywhere, and works best.
Gnome is the notable exception, since it requires applications to use CSD. This forces applications to have explicit support for Gnome (my understand is that it's to kinda force applications to have dedicated Gnome-support, further pulling them into the Gnome/Gtk ecosystem).
I don't think there's any way to have customised decorations with SSDs though; it's generally an all-or-nothing kind of thing.
27 remaining items
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
WhyNotHugo commentedon Jun 11, 2021
Looks like this is a duplicate of #27016
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations
linux: Add support for Wayland window decorations