Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to skip animation when switching space with ctrl+left/right (patching) #2530

Open
hbouhadji opened this issue Feb 8, 2025 · 3 comments

Comments

@hbouhadji
Copy link

os: 15.1.1 apple silicon

I wanted a way to disable animation when switching space with ctrl+left/right without needing skhd (mainly to challenge myself)

I've found this:

Image

You can find it by searching: C0035FD688E243391F050071

Using lldb you can do something like that:
Image

Basically writing 1 to the register x8 and it will be fine

Maybe this can be added to osax ? @koekeishiya

swift is really a PITA (!) to reverse

@koekeishiya
Copy link
Owner

I think it would be a lot of work to backport this for all the various macOS versions that yabai supports; for both x64 and arm64, and I don't think it is appropriate to add incomplete support.

It is unlikely that I will spend time on this, sorry.

@hbouhadji
Copy link
Author

Not even as a experimental / hidden feature ? I'm only using the scripting addition for the animations

Guess I will try to figure out how osax works and fork it, thanks anyway

@koekeishiya
Copy link
Owner

koekeishiya commented Feb 11, 2025

The osax so far patches/overwrites existing instructions with either a single or multiple instructions to cover the same number of bytes, to change the animation time loaded for cmd+tab and mission-control shortcuts that go directly to a specific space by number. See https://github.com/koekeishiya/yabai/blob/master/src/osax/payload.m#L375

You'd have to do something similar at the locations you discovered, and basically have it modify the register value directly.
If there are not enough free bytes to just overwrite an existing instruction with the one you need, you could create a code cave; basically allocate a separate block of memory, write a jmp/branch instruction into the target location, recreate any instructions you destroyed, do your own instructions and jump back into the appropriate location in the function, to return control back to normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants