Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trick — Reduce redraw lag when switching spaces #113

Open
devnoname120 opened this issue Aug 19, 2022 · 0 comments
Open

Trick — Reduce redraw lag when switching spaces #113

devnoname120 opened this issue Aug 19, 2022 · 0 comments

Comments

@devnoname120
Copy link

devnoname120 commented Aug 19, 2022

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.

@devnoname120 devnoname120 changed the title Trick — Improve redraw lag when switching spaces Trick — Reduce redraw lag when switching spaces Aug 19, 2022
apoxa added a commit to apoxa/dotfiles that referenced this issue Jan 31, 2023
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

No branches or pull requests

1 participant