Skip to content

feat: focus ring fade animation and gradient rotation#3577

Open
oblivion8282-1337 wants to merge 1 commit intoniri-wm:mainfrom
oblivion8282-1337:feature/focus-ring-fade-animation
Open

feat: focus ring fade animation and gradient rotation#3577
oblivion8282-1337 wants to merge 1 commit intoniri-wm:mainfrom
oblivion8282-1337:feature/focus-ring-fade-animation

Conversation

@oblivion8282-1337
Copy link

Summary

  • Fade animation: Focus ring smoothly fades in/out on focus changes using an EaseOutCubic curve, instead of appearing/disappearing instantly.
  • Gradient rotation: The focus ring gradient continuously rotates while a window is focused, adding a subtle dynamic effect.

Both features are fully opt-in via the focus-ring {} config block:

focus-ring {
    width 2
    active-gradient from="#7aa2f7" to="#bb9af7" angle=45
    fade-duration-ms 1000
    gradient-spin-speed 90
}
  • fade-duration-ms — duration of the fade in/out (0 or omitted = off)
  • gradient-spin-speed — rotation speed in degrees/second (0 or omitted = off)

No behavior changes when these options are not set.

Changed files

  • niri-config/src/appearance.rs — new config fields
  • src/layout/focus_ring.rs — gradient angle offset parameter
  • src/layout/tile.rs — fade animation + gradient rotation logic
  • src/layout/insert_hint_element.rs — pass through new fields
  • src/ui/mru.rs — pass through new fields

Test plan

  • Tested fade with various durations (200ms–1500ms), 500–1000ms feels best
  • Tested gradient rotation at different speeds (45–180 deg/s)
  • Verified no effect when config options are omitted
  • Verified no performance impact in normal use

🤖 Generated with Claude Code

Add two new optional animation features for the focus ring:

- Fade: smoothly fades the focus ring in/out on focus changes
  using an EaseOutCubic curve. Configurable via `fade-duration-ms`
  (default: off, recommended: 500-1000ms).

- Gradient rotation: continuously rotates the gradient angle while
  a window is focused. Configurable via `gradient-spin-speed` in
  degrees per second (default: off, e.g. 90 for a slow spin).

Both features are opt-in and have no effect unless explicitly
configured in the `focus-ring {}` config block.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Anderson0xFF
Copy link

This is amazing! I was looking for something similar for Niri, since it currently doesn't support animated borders.

@Ozogorgor
Copy link

I haven't been using Niri for long (~3 weeks), but from what I can tell decoration rendering (borders, focus rings, etc.) currently isn't part of the shader pipeline.

If decoration rendering could be exposed to shaders, it might enable shader-based effects or animations for borders and focus rings. A shader implementation would give me more control over the type of animation I want of my decorations. I also might be completely wrong with my assumptions, but these are my two cents.

@Sempyos Sempyos added area:visuals Animations, shaders, visual artifacts area:config Config parsing, default config, new settings area:layout Columns, workspaces, scrolling, fullscreen, resize pr kind:feature New features and functionality and removed area:layout Columns, workspaces, scrolling, fullscreen, resize labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:config Config parsing, default config, new settings area:visuals Animations, shaders, visual artifacts pr kind:feature New features and functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants