Overlay windows decorations on top of application chrome

I think it would be nice to overlay server side window decorations on the app chrome, similar to how it’s done on Mac with NsWindow, where the compositor and application negotiate ownership over the titlebar area. The result is that decorations can look entirely consistent with both the application goals and the system style.

Take a look at this app. The ssd strip seems superfluous and clashes with the application. As long as the server draws a cookie cutter stip on top the app, these problems are going to persist.

I’m not going to bother doing a mockup because I trust everybody knows how it would look on mac os: the artwork area would be extended all the way to the edge of the window and the traffic lights and transparent drag area would be overlayed on top of it. The usual counterarguments are that you’d lose the title, but in the case of this app - where the entire top region prominently displays the song you’re playing - who in their right mind wants to read the title off the titlebar? I think most people would be happy to dispense with redundant info in order to save screen real estate and get significantly more elegant-looking applications.

Or look at a typical Kirigami application:

It tells you “Keyboard” four times, with the toolbar strip positively screaming KEYBOARD. What purpose does the dedicated titlebar serve here? To inform the user, for the fourth and final time that this window pertains to keyboards? If the titlebar were merged with the toolbar area, absolutely nothing of value would be lost. The UI would just look smarter and vertical screen real estate would be saved.

Another problem this would solve is the fact that on KDE, the toolbar and titlebar are visually merged. Hover they aren’t functionally merged. You can’t double click the toolbar area to maximize the window. Dragging isn’t guaranteed either. But since the toolbar and titlebar aren’t delineated, the user isn’t really sure where he is supposed to click in order do window management. A few pixels too low and you’re not in the titlebar area anymore. This proposal would get rid of the problem completely.

Third and final bonus to doing this is potentially better stylistic integration on other desktops and OS’ where some merger between titlebar and app chrome is now standard, and it is traditional titlebar apps that now “look out of place”. If you can set aside space for Kwin to draw decorations, you can potentially use that space - further down the line - for NsWindow type decorations on Mac Os. You could also use that space to draw true CSD on Gnome. If you slap a libadwaita theme on there too, you’d get essentially native-looking KDE apps on Gnome, improving adoption beyond KDE.


So to sum up potential benefits:

  1. Less redundant info
  2. Saves vertical space
  3. Greater visual consistency within the application window (e.g. no unintended visual mismatches between application and titlebar)
  4. Arguably easier and more predictable window management experience over current behavior.
  5. Can lay groundwork for better UI integration on other desktops down the line.
  6. Potentially make non-QT apps look and feel much more native on KDE (with user or other third party intervention, as explained below)

To implement this, apps would need to define a draggable area and set some space apart for the system min/max/close buttons. For a traditional app with menubar, it should be relatively trivial: just set the entire menubar area as drag space and leave space in the corners (which is almost always empty anyway) for the WM buttons.

For the vast majority of QT apps I suppose this could even be done entirely through the theme engine, without any modification to apps. That’s not to say to that it should - matter of preference - but it could.

This could even be accomplished without any support from the app whatsoever - again, not to say that it should necessarily but it could - you could just overlay a transparent title-bar on the entire menu-bar, shove the title and WM buttons in the free space on the right, set a rule saying “window title+buttons cannot encroach on the menubar beyond x window width , and call it a day. This same approach could be used to reliably overlay KWin min/max/close buttons on applications that insist on drawing their own. Right now Gnome apps draw their own WM buttons but use the breeze icon theme (I think) to render the actual glyphs on kde. The result doesn’t look like KDE or Gnome - it just looks broken. Simply overlaying the ssd controls over the native ones, behind the apps’ back would actually be preferable to the status quo in this case. KDE also does some complex wizardry to make breeze-style WM buttons on GTK3, would simply painting over them really be worse? Maybe yes maybe no, rational people can disagree I suppose.


There’s ample prior interest in putting “something” into the menubar from KDE community. Locally integrated menus have been discussed for some time and are apparently going to be officially part of future plasma desktop releases. Others have proposed solutions that are essentially identical to what I’m proposing here in more (perhaps too much :slight_smile: ) detail.

Apparently this has already been proposed by somebody for wayland but the issue has stalled. I think the way to move forward on it would be to implement something on KDE first. Otherwise it’s just going to be arguments about maybe doing something with Gnome people saying “we won’t do it” other people saying “you should do it” and them saying “no we won’t” and so on, and it will just peter out there. But if NSwin style decorations can be shown to work on KDE in a way that people like, it should generate enough interest for other compositors to want to do the same. And if there’s enough interest from projects it could eventually become a wayland extension in a couple years - worth it IMO because without this is there won’t be any consistent window management ever.

1 Like

Not sure if I am looking at the right screen shot but the one for the media player looks ok.

The decoration is clearly visible by itself and does not interfere nor duplicate anything the app itself draws.

If “titlebar” means the window decoration than those are separate from the window content (as the screenshot earlier demonstrated).

Even a “classic” window, e.g. KMail, has visual separation between decoration and content

Screenshot_20251013_105542

I am not sure how likely it is that applications would implement some protocol do get the areas needed for the decoration actions.

They are already not very good at reading the settings.

Doesn’t even need to be a full decoration, just the actions would be great.

Could potentially be done on hover so one would have access to the system actions but still see whatever an app with CSD would like to display there.

Maybe via a KWin window/app rule. One setting for “do nothing”, one for “show classic decoration around the window”, “show overlay decoration”.
Then the user can decide whether the areas of content that would be overlapped are actually of any interest to them.

1 Like

In default breeze theme, they should be merged for all apps - you appear to be using an non default color scheme/theme. If they’re not merged, they just look bad in my opinion, which is probably why KDE chose to merge them visually. Also the titlebar is a thin target, and not really ideal for dragging window - I made it bigger on my system to facilitate dragging.

For the protocol, yeah it would be KDE apps that implement it and nobody else. But for most traditional qt apps it might be done with just a theme engine, so they would “support it” that way. Of course without explicit support, it won’t be fool proof and some human intervention would be needed to determine whether a given app should be given the “NSwindow treatment or not.” But with user intervention anything’s possible, even without any support from the application or style.

The overlay is mandatory for this to work because you need to guarantee titlebar-like behavior in the region in the absence of a title-bar. The presence of buttons or menus there shouldn’t be a problem cause these aren’t draggable. In fact allowing dragging from buttons is a bonus, much bigger drag target than the traditional titelbar.

Edit: Although I do see what you’re saying, for apps that already have CSD yeah you could get away with just painting the WM buttons server-side and the transparent drag overlay would just be a “nice” to have since many of these apps leave precious little drag space and that which they do can be unpredictable.

I would be surprised as it would look really weird to have the same background color for app content and system content but I would have to check with a new user account to be sure.

Edit: apparently Firefox uses the same background color for its toolbar as the Breeze decoration. Chrome seems to use the same color as Qt apps, Chromium has an entirely different one.

It only needs to be as high as the buttons it shows.
Any higher would simply be a waste of space, no?

At least KMail can be dragged from its menu bar and toolbar.
Together with the decoration that is quite a large area.

Seems to be the case for all programs I’ve tried so far, including Firefox and Chromium.

Obviously every window can be dragged anywhere while holding META.

Those already support proper system decorations or least should support them.
The only use case I can see for overlay controls is apps that can’t or don’t want to support that.

This way a user could still get correct window behavior, e.g. maximize vertically/horizontally depending on which mouse button clicks the “maximize” icons.

Right, hence the idea of having this as an option in KWin’s special window/application rules.

I’ve only encountered a few apps with CSD-only but those seem to have titlebar-like behavior in their CSD implementations even if they usually fail to read or apply the system config correctly.

The empty titlebar is simultaneously too big and too small. Too big, because it’s mostly empty space and reduntant title info. Too small because, despite all that wasted space it still provides a small click target. Gnome headerbars are the most ergonomic window decorations I’ve ever used. People should just try them with an open mind, they really do work well, you can even set right-click to max windows from anywhere in the headerbar.

My opinion is that nswindow approach would be improvement over both ssd and csd in many respects, so it can benefit SSD apps too. It’s not an original point - I mean Apple figured this out like 20 years ago.

I think if there’s a working protocol, Pop OS might implement it on their desktop since they support SSD. Gnome might do it too for their apps, it wouldn’t take much work from their end.

Yeah I agree that this is the best starting point

From what I know some KDE folk aren’t against the idea. There have been several people trying to do semi-SSD like Presenting DWD, a Candidate for KDE Window Decorations – Ken Vermette for example.

The problem is implementation. It needs to have a reasonable implementation and tackle the tradeoffs of not using full server sided decorations. This would also need support from clients (and each of the popular application frameworks like GTK, Qt, Electron/Chrome, etc). Wayland kinda makes this worse since this spec would definitely be opt-in (like SSDs are) and not all compositors will implement it. There is a proposal for Wayland spec here Making sure you're not a bot!

2 Likes

DWD was a complicated protocol requiring extensive client side support. This is much simpler. Implementation would be simpler, and it could even be done for the base cases without any client side implementation whatsoever, could be done by the end user. You could then ship these customization like everything else on KDE via “get new stuff”.

Of course some support, even if just a via q style plugin for the menubar/toolbar, would make it a little more robust. It would really be pretty simple - you just set aside areas where the underlying app does nothing.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/167

Lol, guys over there are claiming “Mac decorations are all client-side” ", “you’re absolutely right’s Mac is client side … but”, etc., … completely oblivious to the function of the WindowServer, which draws the shadows and WM buttons, rounds corners, controls dragging etc., as well as to the entire purpose of NSWindow, which is to customize the window chrome within a frame that is ultimately controlled and rendered by the compositor. How do they think older mac apps magically get perfect new-looking window decorations when apple changes the style (something Gnome is utterly incapable of doing - compare GTK2, 3 and 4)?

Mac OS decorations are actually an extremely sophisticated form of server side decorations that allow for client-side modification. If Mac OS used normal SSD or Gnome-style CSD it would never win any design awards for sure.