Skip to content

Add Mission Control Animation Disabling #2753

@Melonchanism

Description

@Melonchanism

While doing some debugging on trying to find out how to switch spaces in Mission Control programmatically without injecting keystrokes, I found that it is possible to disable / adjust the animation duration for entering / exiting / clicking on a space in Mission Control. This doesn't affect switching spaces without closing Mission Control via keyboard shortcuts, or show desktop, but weirdly affects hide desktop.

Code for a working dylib PoC:

#import <objc/objc-runtime.h>
#import <AppKit/AppKit.h>

double hook_animationDuration(void) {
    return 0.0;
}

__attribute__((constructor))
static void init(void) {
    Class WVExpose = NSClassFromString(@"WVExpose");
    Class _TtC8DockCore8WVExpose = NSClassFromString(@"_TtC8DockCore8WVExpose");
    SEL orig_selector = @selector(animationDuration);
    Method orig_method = class_getInstanceMethod(WVExpose, orig_selector);
    Method orig_method_alt = class_getInstanceMethod(_TtC8DockCore8WVExpose, orig_selector);
    method_setImplementation(orig_method, (IMP)hook_animationDuration);
    method_setImplementation(orig_method_alt, (IMP)hook_animationDuration);
}

Modifications could be made to adjust the timing (original is 0.25).
Note the added mangled version for compatibility (unmangled on 15, mangled on 26, and other variations).
Don't know if method swizzling is something that can / will be part of yabai but here we are.

out.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions