koekeishiya / yabai

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

macOS 13 Ventura #1297

Closed koekeishiya closed 12 months ago

koekeishiya commented 2 years ago

This is the collective yearly thread for macOS betas. Please use this to discuss instead of opening new issues.

dominiklohmann commented 2 years ago

I have the first beta up and running in a separate APFS volume.

❯ sw_vers
ProductName:    macOS
ProductVersion: 13.0
BuildVersion:   22A5266r

Relevant system files:

Initial observations:

For reference, here's the yabai window status for a window currently hidden in Stage Manger. Yabai think's it's visible, when in reality it is not, thus causing all other windows on the space to be wrongly tiled.

❯ yabai -m query --windows --space | jq '.[] | select(.app == "Safari")'
{
  "id": 8204,
  "pid": 581,
  "app": "Safari",
  "title": "macOS 13 Ventura Β· Issue #1297 Β· koekeishiya/yabai",
  "frame": {
    "x": -120,
    "y": -1055,
    "w": 948,
    "h": 1055
  },
  "role": "AXWindow",
  "subrole": "AXStandardWindow",
  "display": 2,
  "space": 6,
  "level": 0,
  "opacity": 1,
  "split-type": "vertical",
  "stack-index": 0,
  "can-move": true,
  "can-resize": true,
  "has-focus": false,
  "has-shadow": true,
  "has-border": false,
  "has-parent-zoom": false,
  "has-fullscreen-zoom": false,
  "is-native-fullscreen": false,
  "is-visible": true,
  "is-minimized": false,
  "is-hidden": false,
  "is-floating": false,
  "is-sticky": false,
  "is-topmost": false,
  "is-grabbed": false
}
koekeishiya commented 2 years ago

Is Stage Manager like entering a different mode for that specific desktop? Can an application that is a part of Stage Manager have a window on a different display that is visible and managed by yabai? I guess I probably have to set up a separate volume running Ventura as well to experiment.

I also took a quick look at the Dock.app you uploaded and it should be no problem to update the scripting-addition for this version as well.

dominiklohmann commented 2 years ago

Stage Manager is a single toggle for all non-fullscreen spaces across multiple displays. It operates per non-fullscreen space.

Essentially it's like a fancy single-window mode that allows for grouping windows together by dragging them onto a stage on the left side of your screen. Used that way it could be an alternative to spaces as well.

Lalit64 commented 2 years ago

I can't seem to get yabai scripting addition loaded. I get this error. yabai: scripting-addition either failed to load or could not inject payload into Dock.app! Error: -1708

Output of csrutil status

System Integrity Protection status: unknown (Custom Configuration).

Configuration:
    Apple Internal: disabled
    Kext Signing: enabled
    Filesystem Protections: disabled
    Debugging Restrictions: disabled
    DTrace Restrictions: enabled
    NVRAM Protections: disabled
    BaseSystem Verification: enabled
    Boot-arg Restrictions: disabled
    Kernel Integrity Protections: disabled
    Authenticated Root Requirement: enabled

This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.

When I run yabai --check-sa it returns a 0 exit code

ghost commented 2 years ago

Also get this.

Uzaaft commented 2 years ago

Managed to get the yabai scripting addition loaded by following the wiki. @Lalit64

Lalit64 commented 2 years ago

Managed to get the yabai scripting addition loaded by following the wiki. @Lalit64

Ok. I will try. 😁

koekeishiya commented 2 years ago

The scripting-addition won't inject on macOS Ventura because the code requires a versioning change to use the Mach API: https://github.com/koekeishiya/yabai/blob/master/src/sa.m#L443. The code that is injected also needs to be updated.

I am not particularly interested in programming in my spare time these days, so I have not set up a Ventura partition and I haven't yet looked in details at the changes. My first quick impression has been that everything that currently works on Monterey will continue to work in the foreseeable future. I will pick development back up at some point in the future when I feel motivated/interested enough to do so.

jorpilo commented 2 years ago

Any update?

How did you manage to get the script addition loaded?

jorpilo commented 2 years ago

Hey, I ended up changing the code myself. #1337 has the changes to include checking with macos(13)

As said in the pull request, os version checking can be really improved and this is just a quick fix to at least get something working again...

jorpilo commented 2 years ago

I am trying to get the offsets and signatures for Dock.app, I saw some comments in monterrey about how to get offsets but I am really lost about this.

If anyone is able to help I would appreciate it.

I can provide dock.app from ventura 13 beta 2 if needed

AdamMomen commented 2 years ago

@jorpilo I ended up downgrading my OS to Monterey 12.5.

rsnullptr commented 2 years ago

i really like to help. if someone can point out the right direction, would be very appreciated. sadly mac os sucks on wm, it’s pretty unusable for me without this awesome app :/

Jac-Zac commented 2 years ago

I have done this, I hope it can somehow help and I wonder if someone can guide me and tell me if this is correct https://github.com/koekeishiya/yabai/pull/1337#issuecomment-1245495085

theTechGoose commented 1 year ago

How usable is this on the latest upgrade? Am I good to move over or should I wait?

Jac-Zac commented 1 year ago

I wouldn't update unless you really are interested in testing something new on Ventura. If you are yabai is definitely quite good on the beta too, but there are obviously some missing features mainly in the scripting additions. Therefore, I repeat unless you are really interested in using Ventura and willing too not have all the features you may need do not update. On the other hand if you are interested in tinkering and trying to make it work go ahead and update it, but just do not complain if something is not working as you expected.

dominiklohmann commented 1 year ago

@koekeishiya not sure if you've seen it, but Ventura is supposed to go live on Oct 24th, i.e., next Monday. Do you intend to update the scripting addition based on the RC? I can upload the required files as usual if that's the case.

koekeishiya commented 1 year ago

I can upload the required files as usual if that's the case.

I'll probably look at it during the weekend if you do

dominiklohmann commented 1 year ago

Took me a while to get to this, but here's everything that should be needed. I can give it a spin post updated signatures, got the Ventura rc2 running now.

Dock.zip

SkyLight.framework.zip

❯ sw_vers
ProductName:        macOS
ProductVersion:     13.0
BuildVersion:       22A380
doadam commented 1 year ago

I looked up the symbols on 12.x based on the signatures (because there's no documentation whatsoever of what they are actually pointing at), then found the differences for the newly released Dock version of Ventura. Hacky workaround, not extensively tested (and will definitely break in the future), here are my "signatures" (merely offsets tbh).

The version I've tried this on:

❯ sw_vers ProductName: macOS ProductVersion: 13.0 BuildVersion: 22A380

Dock sha256 (if this is not your hash, this will not work for you):

❯ openssl dgst -sha256 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock SHA256(/System/Library/CoreServices/Dock.app/Contents/MacOS/Dock)= 42e5df10be236aea57e24ee9b527b6bad7ceb86d5b189c4078fa672b22a38a4e

And finally, the patch file is attached. ventura_22A380_hack.txt

I'd recommend creating a patchfinder that works out of yabai, puts the required offsets into a json or something similar, then the payload will read from it and use it accordingly. This way it would be easier to maintain, and also if the patchfinder runs externally, it is possible (and easy) to make strong signatures that will not break every major.

koekeishiya commented 1 year ago

I'd recommend creating a patchfinder that works out of yabai, puts the required offsets into a json or something similar, then the payload will read from it and use it accordingly. This way it would be easier to maintain, and also if the patchfinder runs externally, it is possible (and easy) to make strong signatures that will not break every major.

See my comment: https://github.com/koekeishiya/yabai/issues/1091#issuecomment-995808162

haarmannthiemann commented 1 year ago

Awesome, compiled the latest master and everything works again. For other people upgrading, here is what I did:

git clone https://github.com/koekeishiya/yabai.git
cd yabai
make
make sign
sudo ./bin/yabai --uninstall-sa
sleep 3
sudo ./bin/yabai --load-sa
sleep 3
./bin/yabai

I think it's important to uninstall the old scripting additions, it might not be necessary though, and I had to run ./bin/yabai --load-sa twice for it to work again, anyhow, back to tiling / instant space switching with yabai! bye bye Stage Manager =)

Thanks so much koekeishiya!!

phyllisstein commented 1 year ago

Thank you for giving your time to this, @koekeishiya . yabai is a terrific tool, and I'm grateful for the work you put in so we can continue using it.

rsnullptr commented 1 year ago

Hey guys, awesome news. thanks a lot @koekeishiya πŸ™πŸΌ

I am running this, but i can't make it work as brew service.

brew install koekeishiya/formulae/yabai --HEAD
brew services start koekeishiya/formulae/yabai

the accessibility menu is prompt, permission is given, but the permission keeps prompting.

Also did the "trick" of stop start again, but the same behaviour. Running it as an executable on terminal works.

Any suggestions? Thanks again!

EDIT:

╭─rs at mbp64 in ~
╰─○ tail -f /opt/homebrew/var/log/yabai/yabai.err.log
yabai: could not access accessibility features! abort..
yabai: could not access accessibility features! abort..
yabai: could not access accessibility features! abort..

EDIT2: running on terminal work, but I have a error injecting SA

 ╭─rs at mbp64 in ~
╰─○ /opt/homebrew/bin/yabai
+ declare -A color
+ color["focused"]=0xE02d74da
+ color["normal"]=
+ color["preselect"]=0xE02d74da
+ yabai -m signal --add event=dock_did_restart 'action=sudo yabai --load-sa'
+ sudo yabai --load-sa
yabai: scripting-addition failed to inject payload into Dock.app!
....

if run once on the terminal works, run twice I have that error.

╭─rs at mbp64 in ~
╰─○ sudo /opt/homebrew/bin/yabai --uninstall-sa
╭─rs at mbp64 in ~
╰─○ sudo /opt/homebrew/bin/yabai --load-sa     
╭─rs at mbp64 in ~
╰─○ sudo /opt/homebrew/bin/yabai --load-sa
yabai: scripting-addition failed to inject payload into Dock.app!

if uninstalled on the terminal, and run the app, also receive that error.

╭─rs at mbp64 in ~
╰─○ sudo /opt/homebrew/bin/yabai --uninstall-sa
╭─rs at mbp64 in ~
╰─○ sudo /opt/homebrew/bin/yabai --uninstall-sa
╭─rs at mbp64 in ~
╰─○ /opt/homebrew/bin/yabai                    
+ yabai -m signal --add event=dock_did_restart 'action=sudo yabai --load-sa'
+ sudo yabai --load-sa
+ color["focused"]=0xE02d74da
+ color["normal"]=
+ color["preselect"]=0xE02d74da
+ yabai -m config layout bsp
+ yabai -m config top_padding 10
yabai: scripting-addition failed to inject payload into Dock.app!
0xwal commented 1 year ago

You need to follow this detailed instructions. https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(from-HEAD)

FelixKratz commented 1 year ago

Something seems to have changed regarding to how window ordering works in the SLSOrderWindow* function family, which makes the animations a bit rough:

https://user-images.githubusercontent.com/22680421/197950635-19d5c7fc-5d87-424c-8f00-fd7b775aba45.mp4

Additionally I have noticed that there is a WindowManager process now, which is probably Apples Stage Manager. The binary for this process resides in /System/Library/CoreServices/WindowManager.app/Contents/MacOS/WindowManager. Maybe there is some benefit looking into this application in more detail to get an idea how apple handles animations etc.

rsnullptr commented 1 year ago

You need to follow this detailed instructions. https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(from-HEAD)

Thanks you. missed the code sign and the manual add of it. πŸ™πŸΌ

rsnullptr commented 1 year ago

Something seems to have changed regarding to how window ordering works in the SLSOrderWindow* function family, which makes the animations a bit rough:

animation.mp4 Additionally I have noticed that there is a WindowManager process now, which is probably Apples Stage Manager. The binary for this process resides in /System/Library/CoreServices/WindowManager.app/Contents/MacOS/WindowManager. Maybe there is some benefit looking into this application in more detail to get an idea how apple handles animations etc.

a bit off topic, but what is that ui you are using? it reminds me of i3wm.

btw I also have that glitch animation. And noticed a bad behaviour with stage manager enabled - which i think it's fine, since SM sucks πŸ˜“

kalamov commented 1 year ago

Hi all. Thank you so much for your product. I have been using it for several years now. Please tell me, yabai on Ventura works, but for some reason it does not work to switch between desktops. Refreshed yabai/skhd several times, reloaded everything a bunch of times and so on. Nothing helps. I attach a screenshot from the console where you can see that "yabai -m query --windows" works correctly but "yabai -m space --focus 2" doesn't respond at all

Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2022-10-27 Π² 02 53 22
donny-son commented 1 year ago

With the newest(stable) MacOS 13.0 installed, I have installed Xcode 14.1 Release Candidate 2, and reinstalled the development version of yabai. There currently seems to be a issue with the Accessibility request popup. It keeps popping on after giving permission.

koekeishiya commented 1 year ago

@kalamov

You are running v5.0.1. The scripting-addition fix is only on master at this moment.

@donny-son

You need to codesign the binary as mentioned in the wiki instructions for building from source.

donny-son commented 1 year ago

Oops sorry my bad!

bbamnesia commented 1 year ago

Something seems to have changed regarding to how window ordering works in the SLSOrderWindow* function family, which makes the animations a bit rough: animation.mp4

Additionally I have noticed that there is a WindowManager process now, which is probably Apples Stage Manager. The binary for this process resides in /System/Library/CoreServices/WindowManager.app/Contents/MacOS/WindowManager. Maybe there is some benefit looking into this application in more detail to get an idea how apple handles animations etc.

Sorry for the unrelated question, but how did you get your focused window to be highlighted? And what bar are you using? Thank you

yuchanns commented 1 year ago

@rsnullptr @kalamov View the profile of @FelixKratz, I found SketchyBar and dotfiles. It should be helpful to you.

yuchanns commented 1 year ago

Update: Never mind, it works!


I, unfortunately, update to macOS 13.1 today. :sweat_smile: And it looks broken again. I did the instructions below:

brew services stop yabai
brew uninstall yabai
# create yabai-cert as a keychain certificate
brew install koekeishiya/formulae/yabai --HEAD
codesign -fs 'yabai-cert' $(brew --prefix yabai)/bin/yabai
# reconfigure the scripting addition again
sudo bash -c "cat <<EOF > /private/etc/sudoers.d/yabai
$(whoami) ALL = (root) NOPASSWD: sha256:$(shasum -a 256 $(brew --prefix yabai)/bin/yabai) --load-sa
EOF"
csrutil status
# System Integrity Protection status: unknown (Custom Configuration).

# Configuration:
#         Apple Internal: disabled
#         Kext Signing: enabled
#         Filesystem Protections: disabled
#         Debugging Restrictions: disabled
#         DTrace Restrictions: enabled
#         NVRAM Protections: disabled
#         BaseSystem Verification: enabled
#         Boot-arg Restrictions: disabled
#         Kernel Integrity Protections: disabled
#         Authenticated Root Requirement: enabled

# This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.
sudo $(brew --prefix yabai)/bin/yabai --load-sa
# yabai: scripting-addition failed to inject payload into Dock.app!

And it still does not work.

rsnullptr commented 1 year ago

Something seems to have changed regarding to how window ordering works in the SLSOrderWindow* function family, which makes the animations a bit rough: animation.mp4 Additionally I have noticed that there is a WindowManager process now, which is probably Apples Stage Manager. The binary for this process resides in /System/Library/CoreServices/WindowManager.app/Contents/MacOS/WindowManager. Maybe there is some benefit looking into this application in more detail to get an idea how apple handles animations etc.

Sorry for the unrelated question, but how did you get your focused window to be highlighted? And what bar are you using? Thank you

the highlight is this yabai config I guess:

yabai -m config window_border               on
yabai -m config window_border_width         2

you can check my repo with the configs I use: https://github.com/rsnullptr/yabai-skhd-rc

MuhammadcodR commented 1 year ago

Took me a while to get to this, but here's everything that should be needed. I can give it a spin post updated signatures, got the Ventura rc2 running now.

Dock.zip

SkyLight.framework.zip

❯ sw_vers
ProductName:      macOS
ProductVersion:       13.0
BuildVersion:     22A380

can you please tell me how to do this. It would be great if you do

jcrqr commented 1 year ago

Update: Never mind, it works!

I, unfortunately, update to macOS 13.1 today. πŸ˜… ~And it looks broken again.~ I did the instructions below:

brew services stop yabai
brew uninstall yabai
# create yabai-cert as a keychain certificate
brew install koekeishiya/formulae/yabai --HEAD
codesign -fs 'yabai-cert' $(brew --prefix yabai)/bin/yabai
# reconfigure the scripting addition again
sudo bash -c "cat <<EOF > /private/etc/sudoers.d/yabai
$(whoami) ALL = (root) NOPASSWD: sha256:$(shasum -a 256 $(brew --prefix yabai)/bin/yabai) --load-sa
EOF"
csrutil status
# System Integrity Protection status: unknown (Custom Configuration).

# Configuration:
#         Apple Internal: disabled
#         Kext Signing: enabled
#         Filesystem Protections: disabled
#         Debugging Restrictions: disabled
#         DTrace Restrictions: enabled
#         NVRAM Protections: disabled
#         BaseSystem Verification: enabled
#         Boot-arg Restrictions: disabled
#         Kernel Integrity Protections: disabled
#         Authenticated Root Requirement: enabled

# This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.
sudo $(brew --prefix yabai)/bin/yabai --load-sa
# yabai: scripting-addition failed to inject payload into Dock.app!

~And it still does not work.~

Worked like a charm πŸŽ‰

Th0rgal commented 1 year ago

Hey everyone, I just installed Ventura today. Most things seem to work, the only issue I have is with space focusing. I am not able to focus another space using yabai commands like this: yabai -m space --focus 1. It just doesn't do anything.

sashaaldrick commented 1 year ago

Hey everyone, I just installed Ventura today. Most things seem to work, the only issue I have is with space focusing. I am not able to focus another space using yabai commands like this: yabai -m space --focus 1. It just doesn't do anything.

I have the same issue - everything else works and I am installing from HEAD with manual codesigning, but can't switch spaces.

I am getting failed to inject payload into Dock.app however upon loading the scripting addition

IonelLupu commented 1 year ago

Hey everyone, I just installed Ventura today. Most things seem to work, the only issue I have is with space focusing. I am not able to focus another space using yabai commands like this: yabai -m space --focus 1. It just doesn't do anything.

Same here. I don't get any errors. I run the command and nothing happens

buraksirma commented 1 year ago

I use yabai on Ventura without any problem for 2 weeks. Have you guys compiled it from HEAD? yabai -m space --focus 1 also works.

sagikazarmark commented 1 year ago

@IonelLupu @buraksirma Works for me on the latest HEAD version on M1 Ventura.

IonelLupu commented 1 year ago

@sagikazarmark you are right. Installing from HEAD made it work πŸ˜„

FelixKratz commented 1 year ago

The new WindowManager process in Ventura is a bit of a performance monster. It uses so much CPU and all applications report changes in their window layout to it via an XPC connection regardless of wether StageManager is activated or not. I have found that it is OK to unload the process when using yabai, which makes a lot of things faster, battery last longer and stops the apple window manager interfering with yabai:

launchctl unload -F /System/Library/LaunchAgents/com.apple.WindowManager.plist

(only works with SIP disabled I guess) I have added this line to the beginning of my yabairc.

This also stops macOS Ventura from focussing any window on anothers windows destruction, such that yabai would be able to select an arbitrary window without having to deal with the systems default behavior.

Other things that are deactivated by unloading the window manager include window hotkeys as cmd + m, but not cmd + w or cmd + q. This is a great opportunity to take more control over the system via yabai

IonelLupu commented 1 year ago

hey @FelixKratz Interesting.

What are the features we lose by disabling this and how can we enable it back if needed?

shot-codes commented 1 year ago

I'm looking through and seeing people are having success running Yabai from head on the M1. Can anyone confirm if Yabai is working with Ventura on intel macs?

donny-son commented 1 year ago

I'm looking through and seeing people are having success running Yabai from head on the M1. Can anyone confirm if Yabai is working with Ventura on intel macs?

I'm running it on my 27 iMac with system integrity off.

markgeejw commented 1 year ago

I'm having issues with stack layout in Ventura that I didn't before. I can't do yabai -m window --focus stack.prev or stack.next.

Edit: It seems to happen sporadically. When I mean I can't switch focus, I mean that the focus changes, but the focused window does not surface to the top of the stack.

Edit 2: Fixed. Nothing to do with Ventura. Turns out these windows were being set as topmost. I recently turned on config for window_topmost and that reloading spaces/windows sometimes toggles that for windows that were not meant to be floating. Just needed to create a helper script for turning those off on appropriate signals.

jakenvac commented 1 year ago

Hi, has anyone experienced an issue where running yabai as a service doesn't work but everything else is fine? Eg running from the terminal I get no errors. Scripting addition loads fine etc.

I have installed from head and self signed the build.

The error logs say that yabai should not be run as root, however there is nowhere that is requesting it should be running as root.

Edit: No idea why this worked, but for me the solution was to compile from source manually rather than using brew. I signed the binary, stuck it in my path and created my own launch agent and it no works fine. Odd.