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
Linux - Provide window borders and title bar buttons approprate for the user's desktop environment #44540
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
It is my understanding that Windows and macOS impose window border shapes and appearances through their respective window managers. These operating systems also provide native title bar buttons upon request or overlay them automatically.
In contrast, Linux platforms delegate the responsibility for border styles, title bar buttons, their positioning, appearance, and quantity to the Electron application itself.
This approach shifts the burden of proper desktop integration to the application developer. Often, developers opt for a simplified solution: an undrawn square border with three generic buttons (minimize, maximize, and close) positioned in the top-right corner. However, this generic approach may not align with user preferences or conform to the conventions of the current desktop environment.
Proposed Solution
Electron should provide a platform-specific window border and apply two sets of title bar buttons (left and right) to the application upon request.
This system could support multiple desktop environments with unique title bar styling, including but not limited to:
GNOME
KDE
Elementary
COSMIC
While the extent of matching user preferences may vary, this approach would require exposing a generic interface to the underlying application. This interface would automatically apply the correct title bar button styling and appearance using a strategy pattern.
Alternatives Considered
I've explored the possibility of developing a Web Components library that would provide three key components:
A window wrapper component:
Implements the correct border (and shadow, if necessary) for the platform
Optionally includes a simple title bar
A component for the left bank of title bar buttons
A component for the right bank of title bar buttons
This approach would enable developers to incorporate environment-specific window controls without the need to create custom solutions specifically for the Linux platform.
Additional Information
No response
Reacted by Alejandro Ojeda Gutiérrez, do-sch, Wu Tingfeng, Raura, Carlos Parada, bee, null, eyelash, Yoojun Zhou, Arqam and 1 more
Assuming I'm understanding what's going on in your screenshot, hyprland might be offering some native way of rounding the title bar buttons.
However, most WMs don't support this, and it would still mean the application could display the wrong number of buttons for the user's config, on place them on the wrong side of the title bar with the wrong icons for the user's environment.
What I'm calling for is for Electron to either bundle native GTK 4 / Qt6 window decorations to wrap the window with, or provide a config-based lookalike frame for the most common DEs with a fallback to GTK4.
Actually, I'm not talking about the shape of the buttons, I'm talking about the buttons on the far right (like close). I'm sorry that I thought it was obvious.
In some WM, that buttons on the far right of the application don't make sense, so they ask the application to hide them.
Letting the theme engine draw the buttons is the only solution that makes sense. E.g. I’m on KDE Plasma, but I configured it to show the buttons on the left. Electron apps not only completely ignore button shape and icons, but also position:
Reacted by Carlos Parada, null, Burak and Yoojun Zhou
This system could support multiple desktop environments with unique title bar styling, including but not limited to:
* GNOME
* KDE
* Elementary
* COSMIC
While the extent of matching user preferences may vary, this approach would require exposing a generic interface to the underlying application. This interface would automatically apply the correct title bar button styling and appearance using a strategy pattern.
Instead of parsing settings for each individual desktop environment, electron could just call this DBus method: org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings.Read("org.gnome.desktop.wm.preferences", "button-layout")
It could as well listen to 'org.freedesktop.portal.Settings.SettingsChanged' to receive changes of this setting.
Even if it says org.gnome.desktop this setting is exposed by every major desktop environment including KDE, XFCE and Elementary. It returns a string describing arrangement of buttons in the window title bar.
Alternatively, electron could query this string via GtkSettings ("gtk-decoration-layout"), since electron already links with GTK.
The string always contains ":" representing title bar as well as a comma separated list of the following:
"close", "minimize", "maximize", "icon", "menu", "appmenu".
On elementary it would always return "close:maximize". Default setting for vanilla GNOME would be "appmenu:close". Default setting for KDE would be "icon:minimize,maximize,close".
Dependent on this information electron could build two areas in which the wanted buttons are drawn in Linux desktop environments. In Mac OS it can just draw the traffic light indicators on the left and draw nothing on the right. In Windows it could draw the application icon on the left and minimize, maximize and close on the right and the other way around when language is set to rtl languages such as arabic, hebrew or persian.
When it comes to the individual icons of the buttons, window border and border radius on top and bottom corners it gets much harder as there is no universal interface to obtain these settings from. Google Chrome and Firefox both call GTK library functions to load the icons. To get window border information, Chrome parses the GTK Theme and Firefox calls GDK functions. This works on KDE too because KDE generates a GTK Theme to let GTK application look as native as possible.
Update for everyone here -- Electron 43 honours the platform titlebar settings for:
Button relative order
Button visibility (e.g. there won't be a minimize button by default on GNOME)
Leading/trailing configuration (whether some or all buttons will be on the left or right side of the window)
So a large part of this issue can be considered resolved as of 43.0.
The part that is less straightforward is using the actual themed widgets from the platform. Even if we just stick to one toolkit (GTK), Electron allows developers to apply colors to window controls so they will blend well with web content. I don't know how well this would work with GTK buttons but I am going to try it out.
What about using the right icon theme for the close, maximize, and minimize buttons? All the screenshots in this issue show the same (presumably Adwaita) icons. The Ubuntu default theme (Yaru) has thinner icons. KDE (Breeze) also has different icons. Chromium and Electron already have the ability to use the right icons for example if you set the title bar style to native in VSCode on Wayland.
One other thing is the placement of the buttons. They are too close together and the rightmost button almost touches the right edge of the window.
I just took the following screenshot of a few different applications on Ubuntu 24.04. As you can see the buttons are not identical between these apps but they are similar enough. VSCode really sticks out here because of the icons and the button placement.
Thanks for the comparison @eyelash. It is certainly possible for Electron to draw themed titlebar icons from GTK. In fact that's already what happens when you create a window with frame: true (or "show system titlebar").
It is just more challenging to do this for apps that show edge-to-edge web content, since the rest of the row is not a standard GTK titlebar. Electron has to make choices about which values to apply/ignore so it won't conflict with the top row of the web app taking up the same space. It's possible, but we have to be careful. See this prototype using Breeze (GTK theme) on KDE:
@mitchchn Been a while since I wrote Electron, is your example simply with frame: true or is there more to it? I thought frame: true would show a bog standard system titlebar and frame with no ability to draw on it.
Activity
fxzxzyra commentedon Mar 20, 2025
Does this help with the following problem?
WM: hyprland
acerspyro commentedon Mar 28, 2025
Assuming I'm understanding what's going on in your screenshot, hyprland might be offering some native way of rounding the title bar buttons.
However, most WMs don't support this, and it would still mean the application could display the wrong number of buttons for the user's config, on place them on the wrong side of the title bar with the wrong icons for the user's environment.
What I'm calling for is for Electron to either bundle native GTK 4 / Qt6 window decorations to wrap the window with, or provide a config-based lookalike frame for the most common DEs with a fallback to GTK4.
fxzxzyra commentedon Mar 29, 2025
Actually, I'm not talking about the shape of the buttons, I'm talking about the buttons on the far right (like close). I'm sorry that I thought it was obvious.
In some WM, that buttons on the far right of the application don't make sense, so they ask the application to hide them.
flying-sheep commentedon May 6, 2025
Letting the theme engine draw the buttons is the only solution that makes sense. E.g. I’m on KDE Plasma, but I configured it to show the buttons on the left. Electron apps not only completely ignore button shape and icons, but also position:
do-sch commentedon Aug 2, 2025
Instead of parsing settings for each individual desktop environment, electron could just call this DBus method:
org.freedesktop.portal.Desktop/org/freedesktop/portal/desktoporg.freedesktop.portal.Settings.Read("org.gnome.desktop.wm.preferences", "button-layout")It could as well listen to 'org.freedesktop.portal.Settings.SettingsChanged' to receive changes of this setting.
Even if it says
org.gnome.desktopthis setting is exposed by every major desktop environment including KDE, XFCE and Elementary. It returns a string describing arrangement of buttons in the window title bar.Alternatively, electron could query this string via GtkSettings ("gtk-decoration-layout"), since electron already links with GTK.
The string always contains ":" representing title bar as well as a comma separated list of the following:
"close", "minimize", "maximize", "icon", "menu", "appmenu".
On elementary it would always return "close:maximize". Default setting for vanilla GNOME would be "appmenu:close". Default setting for KDE would be "icon:minimize,maximize,close".
Dependent on this information electron could build two areas in which the wanted buttons are drawn in Linux desktop environments. In Mac OS it can just draw the traffic light indicators on the left and draw nothing on the right. In Windows it could draw the application icon on the left and minimize, maximize and close on the right and the other way around when language is set to rtl languages such as arabic, hebrew or persian.
When it comes to the individual icons of the buttons, window border and border radius on top and bottom corners it gets much harder as there is no universal interface to obtain these settings from. Google Chrome and Firefox both call GTK library functions to load the icons. To get window border information, Chrome parses the GTK Theme and Firefox calls GDK functions. This works on KDE too because KDE generates a GTK Theme to let GTK application look as native as possible.
xushengfeng commentedon Oct 29, 2025
It looks like we need a new Wayland protocol for WOC
hsnfirdaus commentedon Dec 8, 2025
Many apps like vscode and discord now using custom window decoration trough WCO in Linux, i'm wondering what make this "decoration" doesn't implemented yet in electron. Is electron already use this: https://docs.gtk.org/gtk4/class.WindowControls.html
tarik02 commentedon Apr 13, 2026
#50978
nikwen commentedon Apr 13, 2026
@mitchchn What is your thought on this? Should we do this?
Everyone else, read Mitch's great article here where he goes into topics like this one: https://www.electronjs.org/blog/tech-talk-wayland
mitchchn commentedon Jun 15, 2026
Update for everyone here -- Electron 43 honours the platform titlebar settings for:
So a large part of this issue can be considered resolved as of 43.0.
The part that is less straightforward is using the actual themed widgets from the platform. Even if we just stick to one toolkit (GTK), Electron allows developers to apply colors to window controls so they will blend well with web content. I don't know how well this would work with GTK buttons but I am going to try it out.
eyelash commentedon Jun 15, 2026
What about using the right icon theme for the close, maximize, and minimize buttons? All the screenshots in this issue show the same (presumably Adwaita) icons. The Ubuntu default theme (Yaru) has thinner icons. KDE (Breeze) also has different icons. Chromium and Electron already have the ability to use the right icons for example if you set the title bar style to native in VSCode on Wayland.
One other thing is the placement of the buttons. They are too close together and the rightmost button almost touches the right edge of the window.
eyelash commentedon Jun 15, 2026
I just took the following screenshot of a few different applications on Ubuntu 24.04. As you can see the buttons are not identical between these apps but they are similar enough. VSCode really sticks out here because of the icons and the button placement.
mitchchn commentedon Jun 15, 2026
Thanks for the comparison @eyelash. It is certainly possible for Electron to draw themed titlebar icons from GTK. In fact that's already what happens when you create a window with
frame: true(or "show system titlebar").It is just more challenging to do this for apps that show edge-to-edge web content, since the rest of the row is not a standard GTK titlebar. Electron has to make choices about which values to apply/ignore so it won't conflict with the top row of the web app taking up the same space. It's possible, but we have to be careful. See this prototype using Breeze (GTK theme) on KDE:
acerspyro commentedon Jun 15, 2026
@mitchchn Been a while since I wrote Electron, is your example simply with
frame: trueor is there more to it? I thoughtframe: truewould show a bog standard system titlebar and frame with no ability to draw on it.