koekeishiya / yabai

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

macOS 14 Sonoma #1772

Closed 0xCUB3 closed 1 year ago

0xCUB3 commented 1 year ago

Yes, yes, it's the first day...

The good news is that yabai is functional. The bad news is that it randomly just stops working, restarts itself, works again, and the cycle continues. Sometimes when I try to start yabai manually, I get this error:

Bootstrap failed: 5: Input/output error Try re-running the command as root for richer errors. Error: Failure while executing; /bin/launchctl bootstrap gui/501 /Users/me/Library/LaunchAgents/homebrew.mxcl.yabai.plist exited with 5.

cockytrumpet commented 1 year ago

the version from homebrew has been working fine for me on sonoma

shrugalic commented 1 year ago

I'm also running the Sonoma golden master first release candidate (Edit: a second one was just released), and yabai (release version 5.0.8) from Homebrew mostly works – except switching spaces.

My main display 1 has spaces 1 to 6. The following command's only effect is focussing a window on the display that the space is on. It does not switch to the chosen space (when display 1 shows space 1 for example):

yabai -m space --focus 2

PS: There's no output in the error log when running yabai as a service (its own service ofc, not homebrew). When running it manually, I do get this error:

command 'window_animation_duration' for domain 'config' requires Screen Recording permissions! ignoring request..

However, yabai does have Screen Recording permissions. I removed and re-added them to be sure.

Update: HEAD version does not switch spaces either

After the above, I did Installing yabai (from HEAD), which did not change anything: switching spaces still does not work. I'm fairly certain I did things correctly:

roelvangils commented 1 year ago

@shrugalic thank you so much for trying this out (and explaining it so clearly) so I didn't have to do it myself. Instantly switching spaces was / is one of Yabai's biggest appeals me. My fingers are crossed that our guru @koekeishiya also gets this functionality working again in Sonoma! πŸ™‚

koekeishiya commented 1 year ago

However, yabai does have Screen Recording permissions. I removed and re-added them to be sure.

I use the documented and recommended Apple API to check whether Screen Recording permissions have been granted, but it appears to be complete garbage so I'll look into using a different way at some point.

TBetcha commented 1 year ago

@shrugalic thank you so much for trying this out (and explaining it so clearly) so I didn't have to do it myself. Instantly switching spaces was / is one of Yabai's biggest appeals me.

I did find a workaround for moving applications to different spaces as well as focusing spaces. I'm not sure how much of it will help you, but sharing in case it does. It is three-tiered, in my system settings I have the mission control space/desktop keyboard shortcuts all using cmd. So cmd <- to move left and cmd 1 to go to desktop/space 1, as an example.

Then in the skhdrc my shortcuts are as follows (I use caps lock as hyper key)

shift + alt + cmd + ctrl - p : yabai -m window --space prev && skhd -k "cmd - left" shift + alt + cmd + ctrl - n : yabai -m window --space next && skhd -k "cmd - right"

Yabai lets me move the window but not focus. Due to this, I have found it immensely useful to trigger the keypress in skhd to change focus using my Mac OS shortcut when I move the application. This results in Yabai moving the window and skhd telling Mac OS to change my focus which gives me the desired effect.

I've done the same moving apps to numbered spaces/desktops with the below, Yabai moves the window to a new space, skhd tells Mac OS to focus it.

shift + alt + cmd + ctrl - 1 : yabai -m window --space 1 && skhd -k "cmd - 1"

I can use the Mac OS keyboard shortcut of cmd - 1 to focus on a space

Moving to different displays works for me, I just can't create/destroy spaces but with the ability to move around windows and focus, I'm most of the way to where I need to be.

shrugalic commented 1 year ago

@TBetcha Thanks a lot for this insightful workaround! It helped me realize the following simple fact (obvious in hindsight). Let me embarrass myself by sharing it πŸ˜…, hoping it helps somebody:

To fall back to switching desktops (AKA "focusing spaces" in yabai parlance) using system shortcuts, one has to also disable/change/remove conflicting shortcuts in skhd. πŸ€¦β€β™‚οΈ (I did try re-enabling system shortcuts yesterday, but forgot to adapt the skhd config, which is why it did not work then).

"Just" switching desktops works fine like this! Except for the horrible desktop-switch animation, which would have been disabled when using yabai to switch.

However, "bringing along a window" while switching desktops does not work so well with bsp layout enabled. By "bringing along a window" I mean having the mouse button down on a window's title bar when pressing the shortcut to switch desktops:

The workaround in the previous comment solves this issue! The price to pay is so have an extra separate shortcut to move windows, rather than using just a single shortcut for switching desktops and moving windows.

In my case I switch desktops using cmd + alt + 1 (or other numbers), and to move windows with this workaround I add shift to that, so cmd + alt + shift + 1 for example.

roelvangils commented 1 year ago

@TBetcha @shrugalic that's interesting, but I'm also a bit confused now. Is your workaround to simulate the traditional keyboard shortcut to move to the next space (aka desktop)?

Because this...

yabai -m space --focus 1

... still does not work with Sonoma. It even gives me this notification when I try it:

20230922_163041_CleanShot@2x

However, Yabai does know which space I'm on, because when I try to switch to a space I'm already on, I get the cannot focus an already focused space. message in the Terminal output.

The reason why I much prefer the yabai -m space --focus way of space switching, is because it used to be instant (no swipe effect and no crossfade effect with "Reduced Motion" on). Even the crossfade is annoying, I think.

shrugalic commented 1 year ago

@roelvangils: Interesting indeed. I've never seen the scripting addition error you mentioned.

Is your workaround to simulate the traditional keyboard shortcut to move to the next space

Yes, basically. skhd first lets yabai move and focus the window, and then "presses" the traditional keyboard shortcut (e.g. skhd -k "cmd + alt - 1" in my case), so the OS switches desktops.

The reason why I much prefer the yabai -m space --focus way of space switching, is because it used to be instant (no swipe effect and no crossfade effect with "Reduced Motion" on). Even the crossfade is annoying, I think.

Totally agree! But better to be able to switch desktops with animation than not at all.

Something else I just discovered: when manually executing the command yabai -m space --focus 1 in a Terminal on the second screen, it does change the space on the first/main screen for me.

It does show the usual desktop-change-animation when doing it, which it should not do, as I have disabled it my yabai configuration, so something is fishy.

When said Terminal is on the main screen, running this command does nothing (except show the error message you mentioned when the target space is the current space). Nor when executing the same command via skhd, as mentioned previously.

koekeishiya commented 1 year ago

I use the following for focusing spaces:

cmd + alt - z : yabai -m space --focus prev || skhd -k "ctrl + alt + cmd - z"
cmd + alt - c : yabai -m space --focus next || skhd -k "ctrl + alt + cmd - c"
cmd + alt - 1 : yabai -m space --focus  1 || skhd -k "ctrl + alt + cmd - 1"
cmd + alt - 2 : yabai -m space --focus  2 || skhd -k "ctrl + alt + cmd - 2"
cmd + alt - 3 : yabai -m space --focus  3 || skhd -k "ctrl + alt + cmd - 3"
cmd + alt - 4 : yabai -m space --focus  4 || skhd -k "ctrl + alt + cmd - 4"
cmd + alt - 5 : yabai -m space --focus  5 || skhd -k "ctrl + alt + cmd - 5"
cmd + alt - 6 : yabai -m space --focus  6 || skhd -k "ctrl + alt + cmd - 6"
cmd + alt - 7 : yabai -m space --focus  7 || skhd -k "ctrl + alt + cmd - 7"
cmd + alt - 8 : yabai -m space --focus  8 || skhd -k "ctrl + alt + cmd - 8"
cmd + alt - 9 : yabai -m space --focus  9 || skhd -k "ctrl + alt + cmd - 9"
cmd + alt - 0 : yabai -m space --focus 10 || skhd -k "ctrl + alt + cmd - 0"

When yabai is capable of focusing spaces it will use that, or if/when it fails (not yet updated as in this case, or yabai may just not be running yet), it will fallback to keybindings that have been assigned in macOS Mission Control shortcuts. That way keybinds for changing spaces will always work.

If you want to send a window to a space, and also focus that space, this simple one-liner should always work, regardless of yabai space focusing being enabled: yabai -m window --space next --focus (works with SIP disabled -- no animation, and enabled -- will be animated).

etzrxd commented 1 year ago

Small disclaimer: the above won't work if you have any apps in native fullscreen open -- the macOS shortcuts for some reason just skip over them.

roelvangils commented 1 year ago

@koekeishiya aha! That makes sense. I've adopted a similar approach for my key bindings now. Thanks for this. However, I'm still curious to know if Yabai will regain the ability to directly focus spaces in the future, or if it's too difficult to work around due to underlying changes in Sonoma. Can you provide some insight on this? πŸ™‚

Bellavene commented 1 year ago

Installed RC and animations stopped working. CGXRemoveTrackingArea: Operation on a window 0x177 requiring rights kCGSWindowRightEventReceiver by caller WindowManager (SystemOwner)

Bellavene commented 1 year ago

Also the HEAD version again asks for full xcode.

donaldguy commented 1 year ago

Release is rolling (of the OS version, I meant)

diocletiann commented 1 year ago

Has changing spaces stopped working for anyone on Sonoma?

0xH4rmony commented 1 year ago

Instant spaces changing is no longer working on Sonoma (on my side) πŸ˜• I have that error when running sudo yabai --load-sa (same as roelvangils above):

CleanShot 2023-09-26 at 22 15 20@2x

jonaburg commented 1 year ago

yes spaces still have issues, but given that it's day 1 of sonoma, i heard donations are a great way to speed up development !

ZirixCZ commented 1 year ago

Can report that switching spaces functionality indeed does not work. There is no output when trying to switch to a space currently not selected yabai -m space --focus next. But there is a message when trying to focus currently active space cannot focus an already focused space. Using the HEAD

albert-ying commented 1 year ago

I haven't updated yet, but although the yabai space switching has problem, does the native space switching shortcut work (you can set it in setting-keyboard as a work around)?

Can anyone confirm it? Thank you

diocletiann commented 1 year ago

I haven't updated yet, but although the yabai space switching has problem, does the native space switching shortcut work (you can set it in setting-keyboard as a work around)?

Can anyone confirm it? Thank you

control + number works but you have to watch the animation

NoahCodeGG commented 1 year ago

yabai-v5.0.8 yabai -m space --focus 1 It's not working.

ZirixCZ commented 1 year ago

I haven't updated yet, but although the yabai space switching has problem, does the native space switching shortcut work (you can set it in setting-keyboard as a work around)?

Can anyone confirm it? Thank you

Yes, it does work.

albert-ying commented 1 year ago

Also the window animation seems stopped working

shrugalic commented 1 year ago

i heard donations are a great way to speed up development !

Thanks for the reminder. I just added my monthly donation at the Patreon listed on the main page: https://www.patreon.com/aasvi/

As a software developer myself, I obviously can't mind paying for software. However I suspect many people would be more comfortable paying something every once in a while (say for big releases such as Sonoma) rather than doing so continually. It looks like Patreon does not seem to offer one-time payments, so I wonder if adding a Paypal or Kofi option might help get more donations?

jonathanwilner commented 1 year ago

Running yabai from HEAD on 23A344 & getting "payload (0x0) doesn't support this macOS version!".

Love to confirm that this is expected behavior until more work is done against Sonoma or I need to investigate my own configuration/installation.

shivajreddy commented 1 year ago

Focusing doesn't work as expected. Been testing out different scenarios and here is what i found.

I have 3 monitors, each having 2 desktop-spaces in each. (in Yabai terminology I have 3 displays with 2 spaces in each).

On Ventura: everything works as expected => focusing on a space (1 through 6) would focus on that particular space even if that was on another monitor, and if that space has no window opened, full screen apps also behave like a space (which is fantastic). on Sanoma (with master branch fdbaaac ):

(wish i knew C to contribute 😣) PS: Thank you tons for this amazing software πŸ™πŸ½, you are a legend koekeishiya

sentreal commented 1 year ago

Yeah, doesn't work here either. No errors or anything, not even when I run commands or --load-sa in iTerm.

SultanSGillani commented 1 year ago

Confirming the same as above. Everything else works.

diocletiann commented 1 year ago

I'm also getting a very very annoying space switch when I close the only window in a space, though it may not be yabai-related. If anyone knows how to fix this please let me know.

TuralAsgar commented 1 year ago

I can not navigate spaces after the update.

TuralAsgar commented 1 year ago

I use the following for focusing spaces:

cmd + alt - z : yabai -m space --focus prev || skhd -k "ctrl + alt + cmd - z"
cmd + alt - c : yabai -m space --focus next || skhd -k "ctrl + alt + cmd - c"
cmd + alt - 1 : yabai -m space --focus  1 || skhd -k "ctrl + alt + cmd - 1"
cmd + alt - 2 : yabai -m space --focus  2 || skhd -k "ctrl + alt + cmd - 2"
cmd + alt - 3 : yabai -m space --focus  3 || skhd -k "ctrl + alt + cmd - 3"
cmd + alt - 4 : yabai -m space --focus  4 || skhd -k "ctrl + alt + cmd - 4"
cmd + alt - 5 : yabai -m space --focus  5 || skhd -k "ctrl + alt + cmd - 5"
cmd + alt - 6 : yabai -m space --focus  6 || skhd -k "ctrl + alt + cmd - 6"
cmd + alt - 7 : yabai -m space --focus  7 || skhd -k "ctrl + alt + cmd - 7"
cmd + alt - 8 : yabai -m space --focus  8 || skhd -k "ctrl + alt + cmd - 8"
cmd + alt - 9 : yabai -m space --focus  9 || skhd -k "ctrl + alt + cmd - 9"
cmd + alt - 0 : yabai -m space --focus 10 || skhd -k "ctrl + alt + cmd - 0"

When yabai is capable of focusing spaces it will use that, or if/when it fails (not yet updated as in this case, or yabai may just not be running yet), it will fallback to keybindings that have been assigned in macOS Mission Control shortcuts. That way keybinds for changing spaces will always work.

If you want to send a window to a space, and also focus that space, this simple one-liner should always work, regardless of yabai space focusing being enabled: yabai -m window --space next --focus (works with SIP disabled -- no animation, and enabled -- will be animated).

Now it works until 9 in the monitor, but doesn't work for 10th in the built-in display. I disconnected the monitor, still it doesn't work with 10th space.

shivajreddy commented 1 year ago

Its' causing more issues than the previous update.

koekeishiya commented 1 year ago

@shivajreddy https://github.com/koekeishiya/yabai/commit/3a70a04b3cf1076a64f53ea06dd10a054e5df5ac crashes for you on window focusing, but https://github.com/koekeishiya/yabai/commit/fdbaaac39b16a1b8af411ae4d5ec0397edcbc990 does not? Both work fine for me.

shivajreddy commented 1 year ago

CleanShot 2023-09-28 at 07 28 55

@koekeishiya Yes sir, here i am trying to focus on another space which is not working, but focusing different windows on same space is working. I am showing my config in case i am overlooking something. (I have the intel mac)

koekeishiya commented 1 year ago

Please keep the discussion to window focusing for now, space focusing is a different matter entirely and I have not started looking at that yet. So in the latest commit (https://github.com/koekeishiya/yabai/commit/3a70a04b3cf1076a64f53ea06dd10a054e5df5ac), does window focusing work without causing yabai to crash?

As mentioned, window focusing works fine for me on the latest commit, which is why I am asking, because I appear to get mixed reports in this thread, and I need to know if the issues are more intricate than it might seem at first glance.

shivajreddy commented 1 year ago

Window focusing works without crashing yabai. one nit pick is that - if I switch focus back&forth between windows very fast, it lags. So its not major, since it works as expected, but when you press keys to toggle the focus very fast, then yabai slows down

koekeishiya commented 1 year ago

if I switch focus back&forth between windows very fast, it lags

That appears to be a macOS thing; I can reproduce this with some applications, but not with others. The focus code is in essence unchanged in yabai since v1.0.6.

Edit: Could also be caused by window borders, which have issues ever since Ventura.

shrugalic commented 1 year ago

Window focusing still works fine for me on 3a70a04, no crash.

(Ever since I joined last week, my issue was space focusing)

diocletiann commented 1 year ago

if I switch focus back&forth between windows very fast, it lags

That appears to be a macOS thing; I can reproduce this with some applications, but not with others. The focus code is in essence unchanged in yabai since v1.0.6.

Edit: Could also be caused by window borders, which have issues ever since Ventura.

I was on 12 until this week, as soon as I upgraded to 13 I saw much worse rendering performance in several apps, Firefox in particular. 14 has not improved.

adriancaruana commented 1 year ago

Thank you @koekeishiya for your continued efforts to maintain yabai, and to @shrugalic for reminding me to donate.

TBetcha commented 1 year ago

Please keep the discussion to window focusing for now, space focusing is a different matter entirely and I have not started looking at that yet. So in the latest commit (3a70a04), does window focusing work without causing yabai to crash?

As mentioned, window focusing works fine for me on the latest commit, which is why I am asking, because I appear to get mixed reports in this thread, and I need to know if the issues are more intricate than it might seem at first glance.

Window focusing works for me, I didn't have any issue with it even during the beta, window borders, or not.

AlbertoMarnetto commented 1 year ago

Thank you @koekeishiya for your continued efforts to maintain yabai, and to @shrugalic for reminding me to donate.

Yes! Yabai improved my quality of life a lot by simply disabling animations under MacOS 13. I really hope that this function can be made available again under MacOS14, but in any case I and many other people have already a huge debt of gratitude with Γ…smund.

yoplat commented 1 year ago

I use the following for focusing spaces:

cmd + alt - z : yabai -m space --focus prev || skhd -k "ctrl + alt + cmd - z"
cmd + alt - c : yabai -m space --focus next || skhd -k "ctrl + alt + cmd - c"
cmd + alt - 1 : yabai -m space --focus  1 || skhd -k "ctrl + alt + cmd - 1"
cmd + alt - 2 : yabai -m space --focus  2 || skhd -k "ctrl + alt + cmd - 2"
cmd + alt - 3 : yabai -m space --focus  3 || skhd -k "ctrl + alt + cmd - 3"
cmd + alt - 4 : yabai -m space --focus  4 || skhd -k "ctrl + alt + cmd - 4"
cmd + alt - 5 : yabai -m space --focus  5 || skhd -k "ctrl + alt + cmd - 5"
cmd + alt - 6 : yabai -m space --focus  6 || skhd -k "ctrl + alt + cmd - 6"
cmd + alt - 7 : yabai -m space --focus  7 || skhd -k "ctrl + alt + cmd - 7"
cmd + alt - 8 : yabai -m space --focus  8 || skhd -k "ctrl + alt + cmd - 8"
cmd + alt - 9 : yabai -m space --focus  9 || skhd -k "ctrl + alt + cmd - 9"
cmd + alt - 0 : yabai -m space --focus 10 || skhd -k "ctrl + alt + cmd - 0"

When yabai is capable of focusing spaces it will use that, or if/when it fails (not yet updated as in this case, or yabai may just not be running yet), it will fallback to keybindings that have been assigned in macOS Mission Control shortcuts. That way keybinds for changing spaces will always work.

If you want to send a window to a space, and also focus that space, this simple one-liner should always work, regardless of yabai space focusing being enabled: yabai -m window --space next --focus (works with SIP disabled -- no animation, and enabled -- will be animated).

This doesn't work for me (already checked for the correct keybinds in keyboard shortcuts). It only works if I remove the yabai command and just use the skhd -k command insted. Maybe the yabai command isn't registered as an error so it doesn't call the second command?

lesgrieve commented 1 year ago

I can confirm that window_manager_focus_window_without_raise is working in macOS 14.0 after following https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(from-HEAD). Thank you @koekeishiya!

pestoAioli commented 1 year ago

I use the following for focusing spaces:

cmd + alt - z : yabai -m space --focus prev || skhd -k "ctrl + alt + cmd - z"
cmd + alt - c : yabai -m space --focus next || skhd -k "ctrl + alt + cmd - c"
cmd + alt - 1 : yabai -m space --focus  1 || skhd -k "ctrl + alt + cmd - 1"
cmd + alt - 2 : yabai -m space --focus  2 || skhd -k "ctrl + alt + cmd - 2"
cmd + alt - 3 : yabai -m space --focus  3 || skhd -k "ctrl + alt + cmd - 3"
cmd + alt - 4 : yabai -m space --focus  4 || skhd -k "ctrl + alt + cmd - 4"
cmd + alt - 5 : yabai -m space --focus  5 || skhd -k "ctrl + alt + cmd - 5"
cmd + alt - 6 : yabai -m space --focus  6 || skhd -k "ctrl + alt + cmd - 6"
cmd + alt - 7 : yabai -m space --focus  7 || skhd -k "ctrl + alt + cmd - 7"
cmd + alt - 8 : yabai -m space --focus  8 || skhd -k "ctrl + alt + cmd - 8"
cmd + alt - 9 : yabai -m space --focus  9 || skhd -k "ctrl + alt + cmd - 9"
cmd + alt - 0 : yabai -m space --focus 10 || skhd -k "ctrl + alt + cmd - 0"

When yabai is capable of focusing spaces it will use that, or if/when it fails (not yet updated as in this case, or yabai may just not be running yet), it will fallback to keybindings that have been assigned in macOS Mission Control shortcuts. That way keybinds for changing spaces will always work. If you want to send a window to a space, and also focus that space, this simple one-liner should always work, regardless of yabai space focusing being enabled: yabai -m window --space next --focus (works with SIP disabled -- no animation, and enabled -- will be animated).

This doesn't work for me (already checked for the correct keybinds in keyboard shortcuts). It only works if I remove the yabai command and just use the skhd -k command insted. Maybe the yabai command isn't registered as an error so it doesn't call the second command?

I'm on the same boat. Spaces not working and this workaround doesnt work unless I completely remove the yabai command, which I guess I'll just have to do and keep checking this thread to see when spaces work again :( Not updating my other laptop to sonoma until this is fixed lol

hientt53 commented 1 year ago

For now, I've switched to use the native Keyboard shortcuts feature in macOS. skhdrc config: rshift + rcmd + rctrl + ralt - 1 : yabai -m space --focus 1 | skhd -k "ctrl + alt + cmd - 1" Note: Adjust the shortcut to match your skdh and Keyboard shortcuts settings."

alexander-ding commented 1 year ago

Just wanted to chime in and say that windows focusing isn't working for me on HEAD (cb19999). Everything else works.

frigaut commented 1 year ago

Just upgraded to Sonoma, uninstall regular yabai, re-installed yabai from HEAD through brew (v5.0.8). Window focusing working fine, as well as swapping, pip, stacking and other features. The only thing that doesn't work for me is focusing spaces. Ready to help testing if needed @koekeishiya

0xCUB3 commented 1 year ago

Thank you so much @koekeishiya!!! Your hard work makes such a great app happen :) It feels like just yesterday when I opened this issue :)

frigaut commented 1 year ago

and 5.0.9 fixes all space focusing issues for me, so everything back to how it was pre-sonoma. Thanks @koekeishiya.