xdg-decoration: Support windows displaying content within the decoration
It would be useful if applications were to optionally be able to draw their own content under/around the window decoration when server-side decorations are requested. This would allow replicating many of the actual uses of client side decorations in UIs while also retaining part of the consistency provided by having the desktop environment draw the decorations.
The main use of this would likely be
- Web browsers - for putting tabs in the title bar, while retaining a native appearance for window controls
- Applications with "immersive" content like video players or games that may wish to hide the title bar on inactivity (Example: QuickTime on macOS fades out the window decoration when its video controls aren't visible)
- Web/Electron-based applications that integrate the window controls into their user interface on macOS and Windows, but currently are unable to on Linux (Example: Discord draws a custom title bar on Windows, and places the window controls above the server list on macOS)
- Applications with their own entirely custom drawing, such as those using minimal UI libraries like imgui, that may still want a more integrated look
Ideally this should enable applications to
- Request to have their surface drawn under the window decoration
- Request to hide (or change the opacity of, for fades?) the overlaid decoration entirely
- Request what style of decoration to draw
- Should the decoration have its background filled
- Should title text be shown
- Should additional items other than the main window controls be shown? (Like the leftmost window menu/stick button in KDE
- Should window buttons be shown
- Perhaps the application could request light/dark controls to properly contrast its user interface?
- Query the positions at which the window has controls drawn over it so the app's UI controls can dodge them
- Query or request a height for the title bar area, so controls will align correctly with the app's designated space for them in their UI
Advantages for app developers over purely client-side decorations:
- Provides a standardized way for applications to
- Unlike full CSD, window controls will still appear in a way that is themed and positioned consistently with the rest of the desktop no matter what framework the application uses (or doesn't) to draw itself
- Less work for the app developer, no need to reinvent rendering window controls in custom-drawn apps
- Hung applications will still have responsive window controls
Examples:
These are some of the styles of windows that would be possible with these features. Here I used screenshots of macOS because it makes doing these things relatively easy.
I don't know if this is out of scope for a server side decoration protocol, or a Wayland protocol in general, feel free to close this issue if that is the case, but I figured I'd suggest it because I think this is functionality that there is currently otherwise no good way to accomplish that a lot of apps on other platforms uses.