feat(windows): a Glass appearance for the Capacity Dock

The second appearance now draws something: a translucent surface inside
the rail's own outline, with a brighter rim than graphite gets, dark
enough at 60 to 74 percent to carry the warm off-white type over any
wallpaper. The mac's Liquid Glass, as far as a shaped window on Windows
can go.

It is painted rather than the acrylic window effect, because that effect
cannot be shaped. Applying it and cutting the window down to the painted
outlines was tried first: a polygon region built from the flattened rail
and bubble paths, handed to SetWindowRgn, which reported success and left
a complex region on the window. The blur was unmoved. DWM draws an accent
backdrop for the whole window rectangle, and the dock's window is a good
deal larger than the rail: it carries the fully expanded rail plus the
bubble's reach, so the appearance was a grey slab a third of the screen
tall with a faint rail inside it. The corner preference does not clip it
either, which package B already found on the popover.

So the setting is called Glass and not Acrylic, since a name that
promises a blur it cannot give is worse than the honest one. The stored
value still reads the old "acrylic" spelling.
This commit is contained in:
iamtoruk 2026-09-01 21:31:34 -07:00
parent 7423b9b73d
commit 7b5266af51
3 changed files with 38 additions and 13 deletions

View file

@ -639,6 +639,12 @@ export function Dock() {
if (glide && glideProgress >= 1) setGlide(null)
}, [glide, glideProgress])
// The mac's second appearance. Windows cannot shape its acrylic material, so the glass is
// painted inside the same outline as the graphite surface: translucent enough for the
// desktop to move behind it, dark enough to carry the warm off-white type over any
// wallpaper, with a brighter rim than graphite gets.
const glass = prefs.theme === 'glass'
const surfaceFill = glass ? 'url(#dock-glass-fill)' : 'url(#dock-rail-fill)'
const edge = flareEdge
const vertical = railVertical
const cross = vertical ? m.railWidth : m.horizontalRailWidth
@ -707,6 +713,16 @@ export function Dock() {
<stop offset="0.46" stopColor="#09090A" />
<stop offset="1" stopColor="#030304" />
</linearGradient>
<linearGradient id="dock-glass-fill" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stopColor="#2A2C31" stopOpacity="0.60" />
<stop offset="0.46" stopColor="#131416" stopOpacity="0.66" />
<stop offset="1" stopColor="#060607" stopOpacity="0.74" />
</linearGradient>
<linearGradient id="dock-glass-edge" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stopColor="#fff" stopOpacity="0.22" />
<stop offset="0.55" stopColor="#fff" stopOpacity="0.14" />
<stop offset="1" stopColor="#fff" stopOpacity="0.20" />
</linearGradient>
<radialGradient id="dock-rail-glow" cx="0" cy="0" r="180" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#fff" stopOpacity="0.055" />
<stop offset="1" stopColor="#fff" stopOpacity="0" />
@ -718,9 +734,14 @@ export function Dock() {
<stop offset="1" stopColor="#fff" stopOpacity="0.08" />
</linearGradient>
</defs>
<path d={shape} fill="url(#dock-rail-fill)" />
<path d={shape} fill={surfaceFill} />
<path d={shape} fill="url(#dock-rail-glow)" />
<path d={shape} fill="none" stroke="url(#dock-rail-edge)" strokeWidth="0.6" />
<path
d={shape}
fill="none"
stroke={glass ? 'url(#dock-glass-edge)' : 'url(#dock-rail-edge)'}
strokeWidth={Math.max(0.6, m.scale * 0.8)}
/>
</svg>
<div className="dock-rows" style={rowsStyle}>
{ordered.map((provider, index) => {
@ -758,9 +779,14 @@ export function Dock() {
>
{detailH > 0 ? (
<svg className="dock-surface" width={detailW} height={detailH} viewBox={`0 0 ${detailW} ${detailH}`} aria-hidden="true">
<path d={bubblePath(tailEdge, detailW, detailH, tail)} fill="url(#dock-rail-fill)" />
<path d={bubblePath(tailEdge, detailW, detailH, tail)} fill={surfaceFill} />
<path d={bubblePath(tailEdge, detailW, detailH, tail)} fill="url(#dock-rail-glow)" />
<path d={bubblePath(tailEdge, detailW, detailH, tail)} fill="none" stroke="rgba(255,255,255,0.09)" strokeWidth="0.9" />
<path
d={bubblePath(tailEdge, detailW, detailH, tail)}
fill="none"
stroke={glass ? 'rgba(255,255,255,0.20)' : 'rgba(255,255,255,0.09)'}
strokeWidth={Math.max(0.5, m.detailScale)}
/>
</svg>
) : null}
<Detail m={m} provider={hoveredProvider} quota={quota} loading={loading} />

View file

@ -7,14 +7,17 @@
import { invoke } from '@tauri-apps/api/core'
import { listen } from '@tauri-apps/api/event'
export type DockTheme = 'graphite' | 'acrylic'
export type DockTheme = 'graphite' | 'glass'
export type DockGaugeShape = 'circle' | 'squircle'
export const DOCK_THEMES: Array<{ id: DockTheme; label: string }> = [
{ id: 'graphite', label: 'Graphite' },
// The mac's second appearance is Liquid Glass; the Windows equivalent is the acrylic
// window effect, so it is named after what it actually is here.
{ id: 'acrylic', label: 'Acrylic' },
// The mac's second appearance is Liquid Glass. Windows cannot shape its acrylic material:
// the DWM backdrop is drawn for the whole window rectangle and neither a window region nor
// the corner preference clips it, and the dock's window is far bigger than the rail it
// paints. So this is a translucent surface the page draws inside the rail's own outline,
// which is what "glass" can mean for a shaped window here.
{ id: 'glass', label: 'Glass' },
]
export const DOCK_GAUGE_SHAPES: Array<{ id: DockGaugeShape; label: string }> = [
@ -58,7 +61,7 @@ export function parseDockPrefs(raw: Record<string, unknown>): DockPrefs {
enabled: raw.enabled === true,
preferred: typeof raw.preferred === 'string' ? raw.preferred : null,
scale: Math.min(DOCK_SCALE_MAX, Math.max(DOCK_SCALE_MIN, scale)),
theme: raw.theme === 'acrylic' ? 'acrylic' : 'graphite',
theme: raw.theme === 'glass' || raw.theme === 'acrylic' ? 'glass' : 'graphite',
gaugeShape: raw.gaugeShape === 'squircle' ? 'squircle' : 'circle',
providers: Array.isArray(raw.providers) ? raw.providers.filter((p): p is string => typeof p === 'string') : [],
manualSelection: raw.manualSelection === true,

View file

@ -363,10 +363,6 @@ function CapacityDockSection({ quota }: { quota: QuotaState }) {
)
})
)}
<Note>
Appearance and gauge shape are stored now and the rail picks them up with the Capacity
Dock work that follows this one.
</Note>
</Group>
)
}