Skip to content

feat: add blur and spread to effects configuration#67

Merged
lukeyou05 merged 1 commit intolukeyou05:mainfrom
Louis047:fix/effects-border-radius
Jan 24, 2026
Merged

feat: add blur and spread to effects configuration#67
lukeyou05 merged 1 commit intolukeyou05:mainfrom
Louis047:fix/effects-border-radius

Conversation

@Louis047
Copy link
Contributor

Replace Gaussian blur with morphology-based approach to preserve corner shapes.

Changes:

  • Shadow: morphology (dilate) + color matrix (black) + light blur

  • Glow: morphology (dilate) + light blur (keeps border color)

  • Add 'blur' as config alias for 'radius' (backwards compatible)

The morphology dilation expands the shape while preserving corner geometry,

then a light Gaussian blur softens edges for natural effect appearance.

Fixes #64

@Louis047
Copy link
Contributor Author

Showcase below (Config blur: 4, effects: Shadow)

border_radius: 0

image

border_radius: 8

image

The small sharpness you see in the corner is because I use Disable Rounded Corners mod from Windhawk. Other than that you can see that the border now clearly follows the global border radius.

@lukeyou05
Copy link
Owner

Thanks for the PR. I have a couple thoughts:

This seems to just add some CSS-style spread which is something I'm happy to incorporate and actually seems to be what Hyprland does as well, but imo it really shouldn't be forced on others and should instead be made optional just like it is in CSS, niri, and also Hyprland to an extent, especially to avoid messing with people's existing configs. If you're willing, could you add a separate field called spread to EffectParams and EffectParamsConfig which would let users control this, then add a #[serde(default)] to that field in EffectParamsConfig, and also add that field to the window_padding calculation done here, here, here, and here (I should probably refactor that later)? If not or if that's confusing, I'd be willing to work on it myself after I merge the PR.

let blur_amount = (effect_params.std_dev / 2.0).max(1.0);
blur_effect
    .SetValue(
        D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION.0 as u32,
        D2D1_PROPERTY_TYPE_FLOAT,
        &blur_amount.to_le_bytes(),
    )
    .windows_context("glow_blur_effect.SetValue() std deviation")?;

I would also suggest NOT setting D2D1_GAUSSIANBLUR_PROP_STANDARD_DEVIATION aka blur_amount to 0.5x of the config's std_dev like was done in your code shown above since that just breaks expectations given that they are supposed to be the same thing. Instead, I would just use the config value as is.

I'm also not sure I consider this a bug fix in the first place since the prior behavior is expected, and the new behavior is more of a subjective improvement because not everyone prefers the same spread settings. I think if we add the spread as a config option, we could retitle the PR to some sort of feat: which would make me happy because I'm too lazy to add features myself these days especially given that I don't even use Windows anymore 🙃.

Add a separate 'spread' field to control morphology dilation independently

from blur (std_dev). This preserves corner shapes when spread > 0 while

maintaining backwards compatibility (spread defaults to 0).

Changes:

- Add 'spread' field to EffectParams and EffectParamsConfig with #[serde(default)]

- Morphology dilation only applied when spread > 0

- Use std_dev as-is for blur (not halved)

- Update window_padding calculations to include spread

- Add 'blur' as config alias for 'radius' (backwards compatible)

Closes lukeyou05#64
@Louis047 Louis047 force-pushed the fix/effects-border-radius branch from 79553ef to 40e7d0b Compare January 23, 2026 05:46
@Louis047
Copy link
Contributor Author

I'm also not sure I consider this a bug fix in the first place since the prior behavior is expected, and the new behavior is more of a subjective improvement because not everyone prefers the same spread settings. I think if we add the spread as a config option, we could retitle the PR to some sort of feat: which would make me happy because I'm too lazy to add features myself these days especially given that I don't even use Windows anymore 🙃.

Oh yeah I didnt approach like this in the first place thinking that it wasn't the behavior and I was completely wrong lmao. Yeah, its better to re-title the PR from a fix: to feat: as this is a whole new feature implementation. I have started working on it now as I'm typing this comment.

And yes, I really wish I could get back to Linux as well, it's just that I don't want to break my system everytime as I love using Hyprland but it's known for its breaking changes which kind of forces me to go back to Windows and also the gaming support is getting good as far as I've heard but it's just not there yet. If everything is all set, at least for the tools I use, I'll be back to it without a second thought. But before that we gotta finish both the PRs 😄

@Louis047 Louis047 changed the title fix: make effects follow global border_radius feat: add blur and spread to effects configuration Jan 23, 2026
@Louis047
Copy link
Contributor Author

Louis047 commented Jan 23, 2026

@lukeyou05 I have done implementing the spread effect config so as to give users the control over both, which also helps preserving the corner radius and also allow users to replicate different shadow spread behaviors.

Configuration example:

effects:
    active:
    - type: Shadow
      blur: 2
      spread: 8
      opacity: 0.8
    
    inactive:
    - type: Glow
      blur: 2
      spread: 8
      opactiy: 0.5

unfortunately it might break the current default configuration but for that in the earlier commit, I have left radius as an alias for that but it follows the blur though. Hope that does it.

@lukeyou05 lukeyou05 merged commit 388e882 into lukeyou05:main Jan 24, 2026
@lukeyou05
Copy link
Owner

Looks good. Thank you!

@Louis047
Copy link
Contributor Author

Happy to work on this :)

Now to the next PR #66 (not done yet lol, hopefully by this week)

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.

shadow effects don't follow global border_radius

2 participants