The default frame now follows codegod100/kde aurorae (Flatkit / Flatkit Dark): the kit's neutral title bar, a 1px outline with 10px top corners, a hairline under the title, a soft 16px shadow all round, a centred title and 24px flat buttons with hover and pressed fills (close turns red). 38px title bar, 1px border. Maximized: no shadow, square corners. - scene: WindowStyle (frame sizes, button layout, hit test) and build_window_decoration; the shadow is part of the decoration ops, so the three rasterisers lost their own offset shadow and redraw 18px around a changed window. - host: the frame size follows the style (work area, wm title-bar room, CSD client boxes, hit zones, screenshots); title-bar buttons track hover, show pressed, act on release. - Settings > Session > Flat window frames (off: the old Breeze-like frame), saved as :window-style :breeze; an unknown value is logged. - docs/window-frames.md; tests for both styles' pixels, button states and switching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hmKDDLLES2aBrrnPxT
4.4 KiB
Window frames
Chandra draws the frame (title bar, outline, buttons, shadow) around every window that lets it:
apps that ask for server-side decorations through zxdg_decoration_manager_v1, and GTK 3 apps
through org_kde_kwin_server_decoration. Windows that draw their own frame (GTK 4, GNOME apps,
Chrome with its own title bar) get none; they fill the frame's box instead (see client_rect
in compositor/host/compositor.mbt).
Styles
Settings > Session > Flat window frames picks one of two styles. It is saved in state.edn as
:window-style :breeze when off; absent (or :flat) is the flat frame. An unknown value is
logged (chandra: state.edn: unknown :window-style ...) and the flat frame is used.
Flat (the default) follows V's Flatkit Aurorae theme for KWin,
codegod100/kde aurorae/ (its colours and
sizes are in generate.py and Flatkitrc):
| Flatkit (light) | Flatkit Dark | |
|---|---|---|
| Title bar | #F6F6F7 |
#1C1C1F |
| Outline, hairline under the title | #DADADE |
#3A3A40 |
| Title text focused / unfocused | #1E1E22 / #66666E |
#EDEDF0 / #A0A0A8 |
| Button hover / pressed | #EDEDEF / #DEDEE2 |
#323237 / #3C3C42 |
| Close hover / pressed (white glyph) | #D12D3A / #B8232F |
#E5484D / #EC5F63 |
| Shadow opacity focused / unfocused | 0.20 / 0.11 | 0.45 / 0.28 |
- 38px tall: the 1px outline, 36px of title bar, the 1px hairline. 1px outline left, right and below (Aurorae's "Tiny" border size). Top corners round with a 10px radius, bottom ones square.
- A soft 16px shadow all round, falling off like the theme's gradients (
SHADOW_STOPS). - Title centred on the bar (bold, one point under the theme's font size) while it fits between the buttons on both sides; otherwise shortened with ".." and left-aligned.
- Minimize, maximize (restore when maximized) and close on the right: 24px, 4px apart, 8px from the edge, 1.5px line glyphs. No fill at rest; the hover fill under the pointer, the pressed fill while held; close turns red. A press shows pressed and acts on the release over the same button (moving off first cancels), as in KWin.
- Maximized: no shadow and square corners.
- Light or dark follows the Dark mode switch (the theme's surface brightness).
What differs from the theme under KWin: glyphs and outlines aren't antialiased (Chandra's rasteriser draws whole pixels; a faint second line stands in for the half pixel); a maximized window keeps the 38px bar and its 1px outline (Aurorae shrinks the bar to 34px and drops the outline); the title uses Chandra's UI font rather than Inter SemiBold; there are no keep above/below, on all desktops, shade or help buttons; the shadow is drawn in 2px bands.
Breeze is the frame Chandra had before: 32px title bar in the theme's surface colour, a 2px outline in the accent colour when focused, 18px round buttons (close red), a shadow offset 4px right and 6px down. Hover and pressed show as a ring around the button.
Where it lives
compositor/scene/scene.mbt:WindowStyle(frame sizes, button layout and hit test,button_at) andbuild_window_decoration, which returns the frame as draw ops in the frame's own coordinates, shadow included. Every host draws them as they are: the software renderer (compositor/renderer), the MoonBit host (wasmhost/bin/raster.mbt) and the Rust host (host-wasm/src/raster.rs) have no shadow of their own and redrawSHADOW_PAD(18px) around a window that changed.compositor/host/compositor.mbt:window_style(the style in use;frame_top(),frame_side(),frame_rect()),sync_window_style(applies the setting: the work area, the window manager's title-bar room, the tiled layout and client-decorated windows' sizes follow),title_button_at,title_button_hover,release_title_button.- Tests: compositor/renderer/decoration_test.mbt (pixels of both styles), compositor/host/ decoration_test.mbt (hover, press, cancel, switching styles, state.edn).
Cost
The shadow and frame are plain spans (rectangles, a few rounded fills clipped to the corners), about 70 draw ops per window. The hosts redraw a window's frame only when it changed (moved, resized, focus or hover changed, or something above it moved); a client redrawing its buffer redraws only its own area. Headless, a 1280x800 desktop with two tiled windows rasterises in the same time with either style (5-8 ms a frame on the software renderer).