asmvik / asmvik/yabai

If logic not supported in action?

Open
#2,248 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
29.6k
Forks
750
PR merge metrics
No merged PRs in 30d

Description

I'm trying to make a newly created window stack onto the last existing window (or stack) when there are two windows (or stacks) in the current space. Corresponding command:

`yabai -m signal --add event=window_created action="if [ $(yabai -m query --windows --space | jq '.[].\"split-type\"' | grep none | wc -l | tr -d ' ') -eq 0 ]; then yabai -m window last --stack \$YABAI_WINDOW_ID; echo true >> /tmp/test; fi"`

If there is only one window (or stack), the value of `split-type` will only be `none`, so the result of `$(...)` is larger than 0. Thus the if branch is not taken.

But the reality is that when there is only one window (or stack), the if branch is still taken.

Not sure what went wrong.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the event=window_created signal using the supplied action and compare the query output when there is one window or stack versus two. Start by checking how the shell condition, command substitution, and escaped YABAI_WINDOW_ID are interpreted; done means the action's branch behavior matches the documented window count.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.