Conversation
lekifier
force-pushed
the
fix/border-flicker-debounce
branch
2 times, most recently
from
August 2, 2026 14:54
685abf1 to
d9a62b6
Compare
…thout lag During a space change, a window is hit by a burst of events (unhide, level, reorder, focus) that each trigger border_update, producing a visible flicker for every redraw. An earlier version of this fix debounced every redraw by 80ms. That removes the flicker but makes the border visibly lag behind fast focus changes (e.g. window cycling), because every update reschedules the wait. Make the debounce adaptive instead: - borders already receives EVENT_SPACE_CHANGE (space_handler in events.c); when it fires, open a 500ms transition window. - While inside the window, border_update() debounces by 80ms, so the burst collapses into a single redraw with the final state. - Outside the window, debounce by only 5ms, so the border tracks focus changes almost instantly. The per-border update_generation counter supersedes stale scheduled updates in both modes. Also drop the unreachable async path left behind (border_update_async_proc). Fixes FelixKratz#79
lekifier
force-pushed
the
fix/border-flicker-debounce
branch
from
August 6, 2026 17:23
d9a62b6 to
84eedcd
Compare
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.
Problem
When switching spaces with yabai's instant (scripting-addition) switch, the focused window's border visibly flickers — it gets redrawn several times in quick succession. This does not happen with macOS's native (animated) space switching. Reported in #79.
Root cause
On a space change, a window is hit by a burst of events —
Unhide,Level,Reorder, andFocus— each of which callsborder_update(), and each redraw is a visible flash. The focused border is therefore repainted ~4-5 times within ~50ms.Fix
An adaptive per-border debounce in
border_update():EVENT_SPACE_CHANGE(space_handlerinevents.c); when it fires, a 500ms transition window opens.update_generationcounter; a newer request supersedes older scheduled ones in both modes.Also drops the unreachable async path left in
border_update()(border_update_async_proc).Tested with yabai instant space switching and fast window cycling: no flicker on space change, border tracks focus immediately otherwise.
Fixes #79