asmvik / asmvik/yabai

Yabai window specific rules not working consistently

Open
#1,504 7 comments 8 reactions 0 assignees View on GitHub
help wanted question
Dominant language
C
Stars
29.6k
Forks
750
PR merge metrics
No merged PRs in 30d

Description

The configured rules targetting specific windows do not put the window in the correct space. Sometimes I have to restart Yabai or my machine and then it starts working again.

It appears some windows have a different title on application startup so the rules don't match. For example, the window titles for the zoom.us application are:
1) Zoom
2) Zoom
3) Zoom meeting

My rules are correctly targeting these with regular expressions but during startup, the windows get a different title for a second or two before they settle to the titles mentioned above. I only see this behavior with the zoom application.

Most chrome windows go to the correct space, but at least one goes to the wrong space. I renamed the windows using the window option in the menu bar. Chrome is the only application that allows me to name windows directly but it still has issues. It is also the only application that starts lagging significantly when combined with Yabai. It can't handle popping a tab out from a window without freezing for a few seconds.

Visual Studio Code can restore one window to the correct space all the time but the other window fails most of the time. These windows allow me to control the title using the settings page in VS code where I can set a formula for the titles. I make sure the formula always outputs the same name.

Here is how my display and spaces are defined:
-Display1: space 1, space 2, space 3, space 4
-Display2: space 5, space 6, space 7, space 8
-Display3: space 9, space 10, space 11, space 12

Here what my yabairc look like:

`yabai -m config mouse_follows_focus on
yabai -m config focus_follows_mouse off
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config window_shadow off
yabai -m config window_border off
yabai -m config window_border_width 4

yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config mouse_modifier fn
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize

yabai -m config layout bsp

yabai -m space 9 --layout stack
yabai -m space 10 --layout stack
yabai -m space 11 --layout stack
yabai -m space 12 --layout stack
yabai -m space 6 --layout stack

yabai -m rule --add app="^System Preferences$" manage=off
yabai -m rule --add app="^Activity Monitor$" manage=off
yabai -m rule --add app="^Numi$" manage=off
yabai -m rule --add app="^belenaEtcher$" manage=off
yabai -m rule --add app="^Synology Drive Client$" manage=off
yabai -m rule --add app="^OpenVPN Connect$" manage=off
yabai -m rule --add app="^Grammarly Desktop$" manage=off

#Space 1
yabai -m rule --add app="^Google Chrome$" title="master" space=1
yabai -m rule --add app="^Google Chrome$" title="media" space=9
yabai -m rule --add app="^iTerm2$" title="Master" space=5
yabai -m rule --add app="^Code$" title="juange" space=5

#Space 2
yabai -m rule --add app="^Google Chrome$" title="ws" space=2
yabai -m rule --add app="^zoom.us$" title="Zoom" space=10
yabai -m rule --add app="^Numi$" space=10
yabai -m rule --add app="^Sourcetree$" title="Sourcetree" space=10
yabai -m rule --add app="^Postman$" space=2
yabai -m rule --add app="^Slack$" space=6
yabai -m rule --add app="^Microsoft Outlook$" space=6
yabai -m rule --add app="^Finder$" space=6
yabai -m rule --add app="^Excel$" space=6
yabai -m rule --add app="^zoom.us$" title="Zoom Meeting.*" space=6

#Space 3
yabai -m rule --add app="^Google Chrome$" title="script" space=3
yabai -m rule --add app="^Script Editor$" space=7
yabai -m rule --add app="^Alfred Preferences$" space=11
yabai -m rule --add app="^Sublime Text$" space=3

#Space 4
yabai -m rule --add app="^Google Chrome$" title="code" space=12
yabai -m rule --add app="^Code$" title="^ws.*$" space=4
yabai -m rule --add app="^iMovie$" space=4
yabai -m rule --add app="^Meld" space=12
yabai -m rule --add app="^Sourcetree" title=".*(Git)" space=8
yabai -m rule --add app="^iTerm2$" title="^Code.*$" space=8`

I few other things I forgot to mention:

Space 6 loses its stack layout configuration after some use. Especially after waking up from sleep state while space 5 gets its configuration somehow. So space 6 becomes a BSP layout and space 5 a stack layout.

After waking up from sleep some windows appear in space 1 despite having a rule set to a different space.

I tried building from source but somehow could not handle codesigning correctly so I kept getting the accessibility prompt indefinitely. I followed the instructions on the wiki to no avail.

For now, I uninstalled Yabai because it had too many disruptions to my daily workflow. After waking up from sleep, it usually becomes unstable, and the yabai.rc configuration appears to change on its own or does not work at all.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided yabairc rules and reproduce the reported behavior around application startup and waking from sleep. Compare window placement and space layout before and after those events; done would require consistent rule matching and preserved space layouts, but the issue does not identify a specific source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.