Add a drop shadow cast by the frame
New plugin:hyprchrome:shadow_size (px, 0 = off), shadow_color and shadow_offset (vec2). Off by default, so existing setups are unchanged. The silhouette is the frame's own outer boundary - extracted out of GetBorderTexture into AppendFrameOuterPath so the shadow and the shape casting it can't drift apart - filled into an A8 mask, blurred with three box passes, then tinted. The frame's cutouts (side notches, the strip beside the title bar) are part of that outline, so they cast their shape for free. Three things worth not undoing later: - The window's interior is cleared after the blur, not before. Punching it first leaves the blur smearing shadow inward across the window's own content. Clearing afterwards puts the cut exactly on the ring's inner boundary, where the frame's opaque pixels hide it. - The shadow is not part of the decoration's reserved extents, since reserving it would push neighbouring windows away by the shadow's width. It's drawn past the decoration's box instead, which is why damageEntire() and boundingBox() expand by ShadowMarginLogical(). - It renders at no more than kShadowMaxDim px on the long edge and lets the GPU upscale. A blurred blob loses nothing to that, and a full-resolution blur would otherwise be re-run per frame for the whole length of a resize animation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,6 +43,19 @@ struct GlobalState {
|
||||
"Peak opacity of the inward glow at the window edge, 0-1",
|
||||
0.35F,
|
||||
FloatValueOptions{.min = 0.F, .max = 1.F}),
|
||||
.shadowSize = makeShared<IntValue>(
|
||||
"plugin:hyprchrome:shadow_size",
|
||||
"How far the frame's drop shadow reaches past its outline, in pixels (0 disables it)",
|
||||
0,
|
||||
IntValueOptions{.min = 0}),
|
||||
.shadowColor = makeShared<ColorValue>(
|
||||
"plugin:hyprchrome:shadow_color",
|
||||
"Color of the frame's drop shadow; its alpha is the shadow's opacity",
|
||||
RGBAToARGB(0x000000B3)),
|
||||
.shadowOffset = makeShared<Vec2Value>(
|
||||
"plugin:hyprchrome:shadow_offset",
|
||||
"How far the shadow is displaced from the frame, in pixels (positive is right/down)",
|
||||
Config::VEC2{0.F, 0.F}),
|
||||
.titlebarHeight = makeShared<IntValue>(
|
||||
"plugin:hyprchrome:titlebar_height",
|
||||
"Height of the title bar hanging off the floating top-border cutout, in pixels",
|
||||
@@ -64,6 +77,9 @@ struct GlobalState {
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.inactiveColor);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.glowSize);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.glowStrength);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.shadowSize);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.shadowColor);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.shadowOffset);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.titlebarHeight);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.titlebarTextSize);
|
||||
HyprlandAPI::addConfigValueV2(plugin, config.titlebarFont);
|
||||
|
||||
Reference in New Issue
Block a user