Skip to content

feat(titlebar): a Linux window with its own title bar keeps its shadow, rounded corners and resize handles - #2360

Draft
Hona wants to merge 13 commits into
devfrom
linux-frame-shadow
Draft

Hona wants to merge 13 commits into
devfrom
linux-frame-shadow

Conversation

@Hona

@Hona Hona commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

A window with Rune's own frame on Wayland (#2244) was square, had no shadow, and resized from a band inside its edges. It now has a shadow, a one-point border, four rounded corners and resize handles outside its edges, as a GTK window has. Follow-up of #2244; tracks #591.

How

The window no longer opens without decorations. It keeps the client-side frame the toolkit already draws on GNOME, without its header bar.

flowchart TB
  subgraph before["#2244: decorations off"]
    B1[content: square, no shadow]
    B2[resize band 5 pt INSIDE the edges]
  end
  subgraph after["this change: frame without its header bar"]
    A1[top part: shadow + border + two arcs]
    A2[left / right parts: shadow + border]
    A3[bottom part: shadow + border + two arcs]
    A4[content: cleared outside four arcs]
    A5[resize handles 12 pt OUTSIDE the edges]
  end
  before --> after
Loading
Layer Change
vendor/sctk-adwaita FrameConfig::headerless(). The top part is the bottom part upside down: it reaches a corner radius into the window and is stacked above the side parts. The side parts start at the window's own top corner. No title font and no button layout are looked up.
vendor/winit WindowAttributesExtWayland::with_headerless_frame asks the compositor for client-side decorations and makes that frame in the first configure. WindowExtWayland::has_headerless_frame says whether it exists. The opaque region leaves out all four corner squares.
rune render::csd_corners::Rounding { radius, top } replaces the bare radius: the GPU pass and the CPU frame's clearing take the top two corners as well, and the whole-surface blur region rounds them. Caption::edges is empty where that frame exists, so the inside band is not drawn.

The inside band of #2244 stays as the fallback where the frame cannot be made: a borderless window, a compositor without subsurfaces, or one that keeps its own decorations.

A maximized, tiled or full-screen window is square with no shadow, as the frame already drew it.

What has run

  • Compiled and linked on Linux x64, macOS and Windows at this head by a downstream app's CI build that pins it (chore(deps): NEVER MERGE: Linux proof build of the frame's shadow and rounded corners (follow-up of rune#2244) opencode-rune#1231): winit, sctk-adwaita and rune, with the app. Not built on Linux arm64.
  • Tests: on macOS only, run 45677562826 on this branch's head (with dev 5342f14d1 merged in): 47 test targets ok, none failed; the rune lib 3,707 passed, 0 failed, 17 ignored. This branch's own tests passed there: four cleared corners on the GPU (the runner's virtual Metal adapter) and in a CPU frame, the corners a rounding names, no inside band where the frame exists, the blur region's top corners. They have not been compiled or run on Linux or Windows.
  • Not run anywhere, and not by any workflow here: the two tests added in vendor/sctk-adwaita/src/tests.rs (the top part is the bottom part upside down; a side part's two ends mirror each other). No workflow of this repository tests the vendored crates.
  • Not yet: a picture under any compositor, and a real GNOME desktop.

Draft until those are in. One thing to settle with it: under mutter, a window tiled to half the screen by the keyboard did not resize from its free edge with #2244's inside band (cause not found yet). Here the handles are the frame's own, outside the edges, so that step must be run again on this branch.

The two vendored crates

Crate What this adds to its patch Why it is not upstream as it is How a bump of the crate is done
vendor/sctk-adwaita (vendor/sctk-adwaita.patch) FrameConfig::headerless(): a frame with no header bar. Its top part is the bottom part's picture upside down, the side parts start at the window's top corner, and no title font or button layout is read. It stands on this repository's earlier patch to the same crate (the rounded bottom corners, #1188), which upstream does not have: upstream's frame is square at the bottom and always has a header. It could go upstream as two changes, the corners first. scripts/vendor-sctk-adwaita.sh <version> downloads the published crate and applies the patch, which is one diff from the published crate. A patch that no longer applies fails there and is re-made by hand.
vendor/winit (vendor/winit.patch) WindowAttributesExtWayland::with_headerless_frame, WindowExtWayland::has_headerless_frame, client-side decorations asked for such a window, and an opaque region that leaves out all four corner squares. It needs the frame change above, and it is an attribute for one frame implementation in winit 0.30's Wayland backend, whose frame handling upstream is replacing. scripts/vendor-winit.sh <version> downloads the published crate and applies the patch. That patch is a list of sections applied in order; this change's section is the last one.

Open questions a picture answers

  • The corner radius is the frame's 10 pt. A current libadwaita window may be rounder.
  • Any tiled edge squares all four corners and drops the shadow. GTK squares only the tiled corners.
  • At a fractional scale the frame draws at the next whole scale and the content at the fractional one, so the two arcs are antialiased apart. The bottom corners already have this.

Credit

Builds on the frame's rounded bottom corners (#1188).

Hona and others added 13 commits November 25, 2026 19:30
…d compositor draws no frame (#591)

A Wayland compositor without xdg-decoration (GNOME) draws no window frame, so
winit drew its own grey bar above the app's titlebar. A window with
App::titlebar now opens without decorations there, and Rune draws its own frame:

- the caption buttons the desktop's button-layout names (the settings portal's
  org.gnome.desktop.wm.preferences, followed while the app runs), as round
  buttons over the band, at the side the layout names; all three at the right
  where no portal says;
- Cx::chrome_insets reports their room and the band's height;
- a 6 point band inside the window's edges resizes it (16 points along each
  side of a corner), as window_resize elements in Rune's frame around the
  view, so they show the resize cursors and stay in reach under a modal;
- window_drag regions move the window, maximize it on a double click and open
  the compositor's window menu on a right click, as they already could.

X11 and compositors that offer xdg-decoration (KDE, Sway, Hyprland) keep the
native frame. RUNE_LINUX_FRAME=0 keeps winit's frame and =1 draws Rune's under
any Wayland compositor.

The compositor check and the button-layout parsing follow James Ponwith's
patch for #993; zce's cut-down of it showed the Windows row layout an app can
take from the insets.

Co-authored-by: James Ponwith <[email protected]>
Co-authored-by: Lei <[email protected]>
Six took more of what the view draws at the window's edge (a scroll bar's thumb) than the two patches this follows, which were tried on GNOME at five.
# Conflicts:
#	crates/rune/src/runtime/input/titlebar_tests.rs
#	crates/rune/src/window/host/events.rs
…uttons and tiled sides

With Cx::window_actions and Cx::tiled_edges on dev, the frame no longer guesses: a button the window can't act on (maximize on a fixed-size window, minimize where the compositor has none) isn't drawn, as GTK's window controls leave it out, and a side the compositor tiled has no resize band; the band beside it runs to that end.
…w, rounded corners and resize handles

Where the Wayland compositor draws no frame, a window with App::titlebar opened without decorations: square, no shadow, resized from a band inside its edges. It now opens with winit's client-side frame less its header bar: the frame's subsurfaces draw the shadow and the one-point border around the window, round all four corners while it floats, and carry the resize handles outside its edges, as a GTK window has them. Rune still draws the caption buttons over the app's titlebar.

sctk-adwaita: FrameConfig::headerless. The top part is the bottom part's mirror (it reaches a corner radius into the window and is stacked above the side parts), the side parts start at the window's own top corner, and no title font or button layout is looked up. winit: WindowAttributesExtWayland::with_headerless_frame asks the compositor for client-side decorations and makes that frame in the first configure; WindowExtWayland::has_headerless_frame says whether it exists; the opaque region leaves all four corner squares out. Rune: the corner pass and the CPU frame's clearing take the top two corners as well (render::csd_corners::Rounding), and the band inside the edges is only drawn where no such frame could be made (a borderless window, no subsurfaces, a compositor that keeps its own decorations).

Builds on the frame's rounded bottom corners (#1188).
…ass, so its tests run on every platform

clear_corners moves from window/linux/cpu_frame.rs to render/csd_corners.rs, beside the pass that does the same to a GPU frame and the Rounding both take; its tests move with it (csd_corners_cpu_tests.rs) and no longer need a Linux build to run.
…rs inside its top corners' arcs too

RegionSpec::with_top_corners: the whole-surface blur region's top band is the bottom band's mirror where the client-side frame has no headerbar, so the blur does not show outside the two top arcs the content clears.
dev holds the Linux own frame (#2244) as one commit now: the six files both sides changed take dev's text with this branch's own changes applied over it; the result against dev is this branch's 32 files and nothing else. Docs: the README, the titlebar docs and the first changelog entry say what the window has now.
… window

A touch down is a pointer move and a press in one call, with no frame between them: the band is found, at an edge and at a corner, and a touch past it is the view's. No compositor run has sent a touch at the band yet.
@zce

zce commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Real GNOME run of this branch: Fedora 45, GNOME Shell 51.1, mutter 51.1, Wayland, headerless window. The shadow and the rounded corners are there, and the corner radius looks right on this desktop. I haven't checked tiled edges or fractional scaling, so those open questions stand.

The 1 pt white line around the window in the screenshot is not this frame — it's ColorTheme::auto(). It reads org.freedesktop.appearance color-scheme by spawning dbus-send, and this machine has no dbus-tools, so it always answers light. The app's saved scheme is System, so its content is dark while the frame takes the light map's #dcdcdc.

I have a fix on zce/rune:linux-system-csd-theme (7824acd, one commit on dev 4918969): a System window's frame uses the portal answer Rune already follows for Cx::system_dark, seeded by last_appearance and re-applied in paint, so it also follows a light/dark switch. desktop_dark/window_dark keep their meaning; color_scheme_tests.rs is updated. With it the border is the dark map's #3a3a3a from the first frame, and the downstream app change is anomalyco/opencode-rune#1293.

The repository won't let me open a PR (only collaborators can), otherwise I would. Would you rather cherry-pick it into this branch, or take it as a separate follow-up? It is based on dev, so it can land independently and this branch gets it on its next merge.

Before (the white border is the issue above): https://raw.githubusercontent.com/zce/opencode-rune/pr1184-test-shots/1.png

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants