koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
22.58k stars 630 forks source link

New Windows do not get tiled. If I stop and start yabai the window will be tiled. #2247

Open snazzybunny opened 3 months ago

snazzybunny commented 3 months ago

Hello I am new to yabai. Whenever I make a new window of any application, it doesn't seem to get tiled.

Yabai can query the new window fine. But I can drag this window around like a normal OSX window. If I stop yabai and start it again, the window will be tiled. I have also tried manage=on rules like this:

yabai -m rule --add app="Microsoft Edge" role="AXTextField" subrole="AXStandardWindow" manage=on

But it seems that this behavior happens to any new window created after yabai is already running. Anyone know what is wrong?

On Sonoma 14.4.1 m2 max Installed yabai via brew install koekeishiya/formulae/yabai --HEAD

My config

# for this to work you must configure sudo such that
# it will be able to run the command without password

yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa

# default layout (can be bsp, stack or float)
yabai -m config layout bsp

# New window spawns to the left if vertical split, or top if horizontal split
#yabai -m config window_placement first_child

# New window spawns to the right if vertical split, or bottom if horizontal split
yabai -m config window_placement second_child

# padding set to 12px
yabai -m config top_padding 12
yabai -m config bottom_padding 12
yabai -m config left_padding 12
yabai -m config right_padding 12
yabai -m config window_gap 12

# center mouse on window with focus
yabai -m config mouse_follows_focus on

# modifier for clicking and dragging with mouse
yabai -m config mouse_modifier alt
# set modifier + left-click drag to move window
yabai -m config mouse_action1 move
# set modifier + right-click drag to resize window
yabai -m config mouse_action2 resize

# when window is dropped in center of another window, swap them (on edges it will split it)
#yabai -m mouse_drop_action swap

yabai -m rule --add app="^TextEdit$" role="AXTextField" subrole="AXStandardWindow" manage=on
yabai -m rule --add app="^Microsoft Edge$" role="AXTextField" subrole="AXStandardWindow" manage=on layer=below
yabai -m rule --add app="^Google Chrome$" manage=on
#yabai -m rule --add app="^Microsoft Edge$" manage=on
yabai -m rule --add app="^System Settings$" manage=off
yabai -m rule --add app="^Calculator$" manage=off
yabai -m rule --add app="^Karabiner-Elements$" manage=off
yabai -m rule --add label="Finder" app="^Finder$" manage=off
yabai -m rule --add label="System Preferences$" title=".*" manage=off
yabai -m rule --add label="Software Update" title="Software Update" manage=off
yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off
yabai -m rule --add label="Spotify" app="^Spotify$" manage=off

I tried to start an app from shkd and it makes a new window that doesnt get tiled. Also tried starting an app from alfred. Or using command N in firefox or edge or google chrome.

Query for new window that doesnt tile

{
    "id":3386,
    "pid":708,
    "app":"Microsoft Edge",
    "title":"New Tab - Microsoft Edge",
    "scratchpad":"",
    "frame":{
        "x":34.0000,
        "y":78.0000,
        "w":1010.0000,
        "h":624.0000
    },
    "role":"AXWindow",
    "subrole":"AXStandardWindow",
    "root-window":true,
    "display":1,
    "space":2,
    "level":0,
    "sub-level":0,
    "layer":"normal",
    "sub-layer":"normal",
    "opacity":1.0000,
    "split-type":"none",
    "split-child":"none",
    "stack-index":0,
    "can-move":true,
    "can-resize":true,
    "has-focus":false,
    "has-shadow":true,
    "has-parent-zoom":false,
    "has-fullscreen-zoom":false,
    "has-ax-reference":true,
    "is-native-fullscreen":false,
    "is-visible":true,
    "is-minimized":false,
    "is-hidden":false,
    "is-floating":true,
    "is-sticky":false,
    "is-grabbed":false
}
jcguu95 commented 3 months ago

I have the same issue. Some of the new windows are tiled, while some are not tiled. For example, emacs windows fired up with

shift + cmd - e : emacsclient -c

are not tiled. However, terminal windows fired up with

shift + cmd - return : open -na kitty

are tiled.