comp: add smooth fade transition to active window hint - #2810
Open
DavidDaza2906 wants to merge 1 commit into
Open
comp: add smooth fade transition to active window hint#2810DavidDaza2906 wants to merge 1 commit into
DavidDaza2906 wants to merge 1 commit into
Conversation
DavidDaza2906
force-pushed
the
focus-hint-fade
branch
from
September 1, 2026 22:57
25c988c to
3f1c668
Compare
DavidDaza2906
marked this pull request as ready for review
September 1, 2026 22:57
Member
|
The PR template is required. Please add it back and fill it out. |
Author
|
Sorry about that — I accidentally replaced the template when writing the description. It's filled out now, and I've also added the AI disclosure to the commit message itself, as required by the first checkbox. |
Add an opt-in 'focus_transition_ms' config option (default 0 = exact
current behavior) that fades the focused window's active hint in and
the previously focused window's hint out, instead of switching both in
a single frame.
- cosmic-comp-config: add focus_transition_ms (u64, default 0)
- config: hot-reload handler for the new key
- shell: track focus indicator transition state (from_alpha, direction)
on CosmicMapped; update_active() returns the windows whose activation
changed; re-triggered transitions resume from the currently displayed
alpha so rapid focus changes never flicker
- shell: a single repeating calloop timer drives ~60fps redraws while
any transition is active and self-cancels once they all finish
- render: floating and tiling layouts share the alpha interpolation via
CosmicMapped::focus_indicator_{alpha,visible}, fading the hint in on
the newly focused window and out on the previously focused one
With focus_follows_cursor enabled and overlapping windows, the focus
indicator currently jumps abruptly between windows. A short fade makes
the change read as continuous rather than aggressive. Partially
addresses pop-os#989.
Implemented with AI assistance; the feature design, scope, testing, and
validation were done by the submitter, who understands the changes in
full.
Signed-off-by: DavidDaza2906 <99994731+DavidDaza2906@users.noreply.github.com>
DavidDaza2906
force-pushed
the
focus-hint-fade
branch
from
September 1, 2026 23:05
3f1c668 to
fbf59fd
Compare
Member
|
This change would need to go through @pop-os/ux first, to determine if we want that feature. The referenced issue doesn't indicate that this happened yet.
Code-wise this is also not acceptable. We already have animation logic, this should re-use that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Focus indicator fade transition (
focus_transition_ms)Partially addresses #989 (adds a smooth transition to the active window hint instead of a temporary hint; happy to extend toward that UX)
Problem
The focus indicator ("active hint") currently toggles on/off in a single frame. With
focus_follows_cursorenabled and overlapping windows, focus changes feel abrupt/aggressive:the border pops in and out on every hover.
Approach
This adds an opt-in fade of the focus indicator on activation changes:
focus_transition_msinCosmicCompConfig(default0= exactcurrent behavior, no extra allocations or render work).
Shell::update_activenow returns which windows changed activation state, and eachCosmicMappedstores its transition state (from_alpha, direction) so re-triggeredtransitions resume from the currently displayed alpha instead of restarting — rapid
focus changes (e.g. double events from a single click) degrade to a continuous fade
instead of flickering.
and self-cancels once they all finish (rendering one final settled frame).
CosmicMapped::focus_indicator_{alpha,visible}:Tiling resize/swap indicators keep their existing behavior; only the alpha of the
focus indicator is interpolated.
Notes
0means byte-identical rendering to before for users who don't opt in(the interpolation branch is skipped entirely).
focus_follows_cursor)and keyboard-driven ones, and also fires on workspace switches via
refresh_focus.schedule_render, which is a no-op on the winitbackend (see
State::schedule_render); the fade animates on X11 and KMS backends.Happy to adapt if upstream prefers a different redraw-scheduling mechanism.
Testing
cargo check/build on Arch (rustc 1.97, smithay git e3d461a).change focus with Super+arrows / focus-follows-cursor / clicks, observe the cross-fade
of the hint.
focus_transition_ms: 0rendering is unchanged.border renders at intermediate alpha during the transition (e.g. RGB
57,102,109 mid-fade) and reaches the exact full-accent color (99,208,223) when it
completes, for both fade-in and fade-out directions.
resume-from-current-alpha model and verified clean.