Skip to content

Trick — Reduce redraw lag when switching spaces #113

@devnoname120

Description

@devnoname120

Add the following in ~/.config/yabai/yabairc:

yabai -m signal --add event=space_changed action="hs -A -c 'stackline.manager:update({forceRedraw = true})'"

Optional — comment out these lines to avoid a double redraw:

stackline.spaceWatcher = hs.spaces.watcher.new( -- {{{
function(spaceIdx)
-- QUESTION: do I need to clean this up? If so, how?
-- Update stackline when switching spaces
-- NOTE: hs.spaces.watcher uses deprecated macos APIs, so this may break in an upcoming macos release
log.i(('hs.spaces.watcher -> changed to space %d'):format(spaceIdx))
stackline.forceRedraw = true -- force the next update cycle to redraw
stackline.queryWindowState:start()
stackline:refreshClickTracker()
end
):start() -- }}}

Why: It may be because hs.spaces.watcher() is using a macOS API that is deprecated since macOS 10.8. It always returns -1 as a space id to the callback on newer macOS versions[1].

See Hammerspoon/hammerspoon#3250

See #110 for another performance trick.


[1] Confirmed on macOS Monterey 12.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions