Render border gradients instead of a flat first stop

The frame collapsed Hyprland's border gradient to m_colors.front(), so a
gradient col.active_border showed up as a single flat color.

Snapshot the gradient (stops + angle) into a new header-only ChromeGradient
and fill the cairo path with a linear gradient built from it:

- AxisFor() reproduces the border shader's quadrant-folding progress
  function (y*sin(a) + x*(1-sin(a)), not a true rotation) as a cairo axis,
  so the frame's sweep stays in step with the window border it wraps.
  Checked against a port of the shader across all 360 degrees: cardinal
  angles exact, worst case 0.003 of the sweep (the shader folds on literal
  1.57/3.14/4.71 where this uses pi).
- SampleAt() interpolates in OkLab, where the shader interpolates, with
  each segment subdivided into sampled cairo stops so cairo's own sRGB lerp
  tracks that curve.

active_color/inactive_color become gradient config values, taking the same
syntax as general:col.active_border. Single-color configs are unaffected.

The cross-focus fade (m_realBorderColorPrevious + fade progress, lerped
between two gradients in-shader) is still not reproduced.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-29 20:36:24 +02:00
co-authored by Claude Opus 5
parent 73ce9ddbdf
commit b9dafe2ce1
9 changed files with 215 additions and 43 deletions
+11 -3
View File
@@ -6,7 +6,7 @@ hanging off the top-left corner. The frame's corners are chamfered by an
amount inferred from the window's own border rounding, so the border peeking
out around a rounded window's corners reads as a matching diagonal cut rather
than a hard rectangular corner. Border color tracks Hyprland's own
active/inactive border color live.
active/inactive border color live, gradients included.
## Config
@@ -16,8 +16,8 @@ plugin {
enabled = true # bool
extent = 12 # int, px the border extends past the window edge
follow_hyprland_border_color = true # bool, use Hyprland's own active/inactive border color instead of active_color/inactive_color below
active_color = 0xFFD063FF # AARRGGBB, focused-window border color, used when follow_hyprland_border_color is false
inactive_color = 0xFF6C6C6C # AARRGGBB, unfocused-window border color, used when follow_hyprland_border_color is false
active_color = 0xFFD063FF # focused-window border color, used when follow_hyprland_border_color is false
inactive_color = 0xFF6C6C6C # unfocused-window border color, used when follow_hyprland_border_color is false
titlebar_height = 8 # int, px height of the floating title bar
titlebar_text_size = 12 # int, px font size of the title bar's text
titlebar_font = sans-serif # string, passed to cairo_select_font_face
@@ -25,6 +25,14 @@ plugin {
}
```
`active_color`/`inactive_color` take the same syntax as Hyprland's own
`general:col.active_border` — a single color, or several plus an optional
angle for a gradient:
```
active_color = rgba(ff0000ff) rgba(00ff00ff) 45deg
```
## Installing
```sh