Can yabai move windows from another space to the current space without disabling SIP?
Hello, I use a 13inch mac air so I mostly use spaces to organize my windows. One of my pet peeves is that when I open an app that was on another space or focus on its window, macOS will forcefully switch over to that space. There are also no options to move a window to another space without following it. I've tried some solutions like hammerspoon scripts before but didn't have much success. I heard that yabai can handle moving windows between spaces, but requires disabling SIP, which I'd prefer not to. However, I recently saw somewhere that yabai has pushed an update that doesn't require disabling SIP now, and I was wondering if anyone can verify this? There are three use cases I can imagine: Moving a window from another space to the current space and focus it without leaving the current space Moving a window from the current space to another space without leaving current space Moving a window from the current space to another space and follow it Thank you!
已收集讨论
for the first case, i would be cautious. moving a window between spaces without following it is exactly where macOS gets restrictive. accessibility permissions can focus, move, and resize windows, but space assignment is much less exposed. if you want to avoid disabling SIP, i would test only the non-invasive mode and assume case 3 is the safe one. case 1 and 2 may work in some builds but are the kind of thing that breaks after macOS updates. for a 13 inch laptop, a boring workaround is binding keys to send the current window to a numbered desktop, then using the system shortcut to jump when you actually want to follow it.
Thank you for the response! When you said binding keys to send the current window to a numbered desktop are you referring to using yabai for this, or is there a native macOS feature?
native macOS, mostly. System Settings -> Keyboard -> Keyboard Shortcuts -> Mission Control has shortcuts for switching to desktop 1/2/etc, and you can also use the window menu or dock icon in some cases to assign a window to a desktop. the annoying part is that macOS does not expose a clean "pull this other-space window here" action, so any setup that does that invisibly is usually leaning on a window manager or script. for a no-SIP setup, i would keep it to: send current window to desktop N, then use native desktop shortcuts when you actually want to follow it.
yabai without SIP can still do case 2 and 3 reliably using the move-to-space commands via skhd. case 1 (pull a window from another space without switching) is the tricky one. last i checked it works on some macOS versions but not others, and it tends to break on point releases. if you want something more stable for just that use case, Moom has a "send to space" shortcut that works without any SIP changes and has been consistent across updates.
I’ll check out moom, thanks!
Two separate things are getting tangled here, so let me split them: 1) Your actual pet peeve - macOS force-switching you to another Space when you focus an app that has a window there - is a native setting, no yabai needed. System Settings > Desktop & Dock > Mission Control > turn off "When switching to an application, switch to a Space with open windows for the application." That alone kills the forced jump for Cmd-Tab and Dock clicks. 2) The SIP question - "yabai no longer needs SIP" is a misread. Plain tiling never needed it. Even moving a window to another space (yabai -m window --space 3, without --focus) generally works with SIP on. What still needs the scripting addition - which requires partially disabling SIP and re-running sudo yabai --load-sa after every macOS update - is exactly your case 1: pulling a window from another Space onto your current one without following it, plus focusing Spaces. That requirement hasn't gone away. So if case 1 is the one you care about, there's no SIP-free yabai path today. For that without touching SIP, a "send window to Space" shortcut in Moom (or Swish for gestures) is the reliable route and survives point updates better than SA scripts. Combine it with the setting above and you get most of the two-monitors-on-one-screen feel.
Thanks for the detailed message! You're right, I did cram multiple things into my question there. For the native mission control setting, it doesn't resolve the problem actually. I have that option disabled, but say the iMessage app was on space 4 and I quit it, then later if I open the app while on space 2, it'll switch over to space 4. If the app is already open on space 4, then either the app will be focused with no active window while on space 2 so it feels like nothing happened, or it'll still switch to space 4 (spotify does this). Therefore, when I focus on an app, I'd like for a utility to check if there are open windows of that app on a different space already, and if so, move them to my current space. If not, then open a window on my current space. Is Moom an application that can do this?
I checked Moom's current feature and release documentation, and I would not buy it for this exact rule. Moom can save and apply layouts and can trigger them from display setup changes, sleep, or wake, but I could not find an application focus trigger that searches another Space and pulls that app's window to the current one. Your requirement needs a window manager that can observe app activation and manipulate Spaces, not a layout restorer. The yabai scripting addition remains the closest match, with the same SIP tradeoff you were trying to avoid.
The SIP part is a bit of a myth that keeps getting repeated. yabai has always run with SIP fully on, but only for basic in-space window management. Anything that touches spaces themselves, moving a window to another space, creating or destroying spaces, still needs the scripting addition, and that needs partial SIP disabled today. No recent update changed that, the space APIs just arent exposed through normal accessibility permissions. For your case 1, pulling a window from another space to the current one without switching, even with the scripting addition thats the flaky one that breaks on point releases. Cases 2 and 3 are much more reliable. Someone already pointed at the native toggle for the forced-switch annoyance (Desktop & Dock, uncheck the 'switch to a Space with open windows' option). Thats genuinely the fix for that half, no yabai needed.
Thanks for explaining! I guess apple just makes moving windows from an unfocused space to the current one difficult. As I've touched on in my other response, the native setting doesn't do much unfortunately. Either it won't switch spaces (but then the app's window stays on the other space so I need to manually get it anyways), or it'll still switch (such as for Spotify. Maybe it's an electron app thing?). I thought I saw somewhere that yabai made a push that uses simulated trackpad movement to switch spaces that can accomplish "pseudo instant" space switching, which doesn't require disabling SIP. I was hoping this can be used to create the effect of bringing another window to the current space instantly, but maybe I misheard. Appreciate your response though
Short version: for the three things you listed, you'll still need the scripting addition, and that still needs SIP partially disabled. yabai split its features a while back, so basic window management (resize, move within a space) works with SIP fully on, but anything that touches Spaces, including moving a window to another space, requires the SA. The "no SIP needed now" thing you saw is almost certainly about that basic tier, not the space stuff. There's no version where cross-space moves work with SIP fully enabled. If disabling SIP is a hard no, look at AeroSpace. It sidesteps the whole problem by not using macOS Spaces at all. It emulates its own workspaces by moving windows off-screen, so there's no SA, no SIP change, and no forced animation-switch when you focus a window on another workspace, which sounds like your actual pet peeve. The tradeoff is you mostly stop using native Mission Control spaces and live in AeroSpace's model instead. On a 13 inch Air I'd say that tradeoff is easy to make. If you'd rather stay on native Spaces, turn off "When switching to an application, switch to a Space with open windows" in System Settings > Desktop & Dock. It won't give you move-without-follow, but it stops some of the involuntary space jumping.
I see, thanks for the detailed explanation!
这条评论已在来源处删除。
Infrequent self-promotion is permitted; however, it is not permitted more than once per developer in 30 days. This is counted from the last app post, even if it was removed. For well-established, recognized devs with an app-flair, once per app per 30 days. Always disclose your relationship to your software in comments promoting your app. Promoting your own app in comments is disallowed until you earn 10 karma in r/MacApps and in poor taste when hijacking another developer’s promotion.