Open devnoname120 opened 2 years ago
I'd suggest that you should modify the commands with the a
flag as without it, at least on macOS Ventura, you'll be spammed with prompts to start Hammerspoon as it seems to be not running (even if it is).
I.E yabai -m signal --add event=display_added action="hs -ac 'stackline.refresh()'"
Note the order of the flags -c -A
in the first edited post is incorrect:
❯ hs -c -A 'stackline.manager:update({forceRedraw = true})'
/usr/local/bin/hs: illegal option: stackline.manager:update({forceRedraw = true})
It should be
# See https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#673-event
EVENT_TYPES=(
display_added
display_removed
display_changed
space_changed
application_visible
application_hidden
window_created
window_destroyed
)
for event in ${EVENT_TYPES[@]}; do
yabai -m signal --add event=$event action="hs -A -c 'stackline.manager:update({forceRedraw = true})'"
done
Good catch, thanks.
Using yabai's signals is more reliable than Hammerspoon, as the latter uses some deprecated macOS APIs, some of which don't work anymore (see https://github.com/AdamWagner/stackline/issues/113).
This can be fixed by adding the following code to
~/.config/yabai/yabairc
:Edit: looks like it can quickly cause
stackline
or Hammerspoon to crash, probably due to race conditions and duplicated event handling (yabai's signals defined above +stackline
event callbacks registered in Hammerspoon).