koekeishiya / yabai

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

Feature Request: Master layout #1124

Open I-Want-ToBelieve opened 2 years ago

I-Want-ToBelieve commented 2 years ago

https://dwm.suckless.org/ https://wiki.hyprland.org/Configuring/Master-Layout/ 179357849-321f042c-f536-44b3-9e6f-371df5321836

koekeishiya commented 2 years ago

Is this referring specifically to the master & stacking implementation detail of the "tiled layout"?

kkharji commented 2 years ago

As previous dim user, this would be an awesome addition. When first setting up yabai, I did some complex shortcuts to make this work. still not there yet 😆 . I think indeed it's referring to master & stacking impl

Bellavene commented 1 year ago

A shitty workaround, still no 'send new window to master'. Tried to implement it, but too buggy. It must be done in source, not in scripts.

CURRENT_DISPLAY=$(yabai -m query --windows --window | jq '.display')
WINDOWS_ARRAY=$(yabai -m query --windows --space $(yabai -m query --spaces --space | jq '.index') --display $CURRENT_DISPLAY | jq -r 'map(select(.["is-minimized"]==false and .["is-floating"]==false))')
NUMBER_OF_WINDOWS=$(echo $WINDOWS_ARRAY | jq -r 'length')

case $NUMBER_OF_WINDOWS in
    [0-1])
        yabai -m config split_type auto
        ;;
    2)
        ;;
    3)
        yabai -m config split_ratio 0.5
        yabai -m space --balance x-axis
        yabai -m config split_type horizontal
        ;;
    *)
        yabai -m space --balance x-axis
        ;;
esac

https://github.com/koekeishiya/yabai/issues/1609

I-Want-ToBelieve commented 8 months ago

I have successfully combined krohnkite-core with yabai.

There are still some bugs at the moment. After fixing some bugs, I will release an early version on GitHub. This should not take too long.

https://github.com/koekeishiya/yabai/assets/24669431/fae86b77-691f-4064-869c-350d6815f61c

Bellavene commented 8 months ago

Great, but to do it the right way, we need to change the logic in the source code of yabai. All scripts on top of it are doomed to behave nonsensical.

I-Want-ToBelieve commented 8 months ago

MacOS has some quirks

  1. When closing the last visible window of the same app, if there is a minimized window in the app, the minimized window will be automatically displayed! (WTF)

  2. When closing the last visible window of an app, if the app does not have a minimized window, another app that is different from it will not automatically gain focus! (WTF)

  3. Even if the last window is closed, some apps still exist in the command + tab list! And even if it is selected, it cannot be reopened!!(Pollution)

  4. The closing of the window does not always mean the exit of the app, cmd+q actually closes the app, but it closes all windows(Complex)

Bellavene commented 8 months ago
  1. Something is causing this, macos does not behave like that.
  2. It is the main logic of macos, an app can be run without a window at all. I use a hammerspoon script for a workaround. Or @FelixKratz's fork of yabai fixes that too.
  3. See # 2, mostly to reopen a window you must press a shortcut, either command+n or command+numbers
  4. see # 2
I-Want-ToBelieve commented 8 months ago

Basically all layouts of krohnkite already work on top of yabai.

There are four more things to deal with

  1. When there is no focus, automatically let a window gain focus.
  2. Respond to dock and global menu show-hide events and adjust the available screen size.
  3. Responds to events emitted when the window changes size and position via the mouse
  4. Multi-monitor testing, multi-space can work now, multi-monitor should also work, but there is no test yet
I-Want-ToBelieve commented 8 months ago

Although moving the position of the window through the mouse and adjusting the size of the window through the mouse have not yet been processed

I am still planning to deal with compilation, packaging and distribution tomorrow

Because the requirements of the early version have now been met.

https://github.com/koekeishiya/yabai/assets/24669431/615044d8-cdee-479f-a1ba-bc35af9b0118

https://github.com/esjeon/krohnkite/issues/201#issuecomment-1797711146

I-Want-ToBelieve commented 8 months ago

Currently there are only development versions.

The release of npm, crates.io, brew, nix and github still requires some time to configure github actions and changesets.

https://github.com/I-Want-ToBelieve/yakite