AdamWagner / stackline

Visualize yabai window stacks on macOS. Works with yabai & hammerspoon.
944 stars 47 forks source link

Trick — Reduce redraw lag when switching spaces #113

Open devnoname120 opened 2 years ago

devnoname120 commented 2 years ago

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: https://github.com/AdamWagner/stackline/blob/215b35d383a6d120e9969415d4b6c29bde0cac81/stackline/stackline.lua#L146-L156

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 https://github.com/Hammerspoon/hammerspoon/issues/3250

See https://github.com/AdamWagner/stackline/issues/110 for another performance trick.


[1] Confirmed on macOS Monterey 12.4.