-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaunchPad.mm
46 lines (40 loc) · 2.16 KB
/
LaunchPad.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#import <objc/runtime.h>
#import <substrate.h>
@import Foundation;
@class SBFloatingDockController;
static BOOL hook_isFloatingDockSupported(Class self, SEL _cmd) {
return YES;
}
@class SBFloatingDockDefaults;
static BOOL hook_appLibraryEnabled(SBFloatingDockDefaults *self, SEL _cmd) {
return YES;
}
static void (* orig_setAppLibraryEnabled) (SBFloatingDockDefaults *self, SEL _cmd, BOOL enabled);
static void hook_setAppLibraryEnabled(SBFloatingDockDefaults *self, SEL _cmd, BOOL enabled) {
orig_setAppLibraryEnabled(self, _cmd, YES);
}
static BOOL hook_recentsEnabled(SBFloatingDockDefaults *self, SEL _cmd) {
return NO;
}
static void (* orig_setRecentsEnabled) (SBFloatingDockDefaults *self, SEL _cmd, BOOL enabled);
static void hook_setRecentsEnabled(SBFloatingDockDefaults *self, SEL _cmd, BOOL enabled) {
orig_setRecentsEnabled(self, _cmd, NO);
}
@class SBDeckSwitcherModifier;
static BOOL hook_shouldConfigureInAppDockHiddenAssertion(SBFloatingDockDefaults *self, SEL _cmd) {
return YES;
}
@class SBFloatingDockBehaviorAssertion;
static BOOL hook_gesturePossible(SBFloatingDockBehaviorAssertion *self, SEL _cmd) {
return NO;
}
static void __attribute__((constructor)) ctor () {
MSHookMessageEx(object_getClass(objc_getClass("SBFloatingDockController")), @selector(isFloatingDockSupported), (IMP)&hook_isFloatingDockSupported, NULL);
id floatingDockDefaults = objc_getClass("SBFloatingDockDefaults");
MSHookMessageEx(floatingDockDefaults, @selector(appLibraryEnabled), (IMP) &hook_appLibraryEnabled, NULL);
MSHookMessageEx(floatingDockDefaults, @selector(setAppLibraryEnabled:), (IMP) &hook_setAppLibraryEnabled, (IMP *) &orig_setAppLibraryEnabled);
MSHookMessageEx(floatingDockDefaults, @selector(recentsEnabled), (IMP) &hook_recentsEnabled, NULL);
MSHookMessageEx(floatingDockDefaults, @selector(setRecentsEnabled:), (IMP) &hook_setRecentsEnabled, (IMP *) &orig_setRecentsEnabled);
MSHookMessageEx(objc_getClass("SBDeckSwitcherModifier"), @selector(shouldConfigureInAppDockHiddenAssertion), (IMP) &hook_shouldConfigureInAppDockHiddenAssertion, NULL);
MSHookMessageEx(objc_getClass("SBFloatingDockBehaviorAssertion"), @selector(gesturePossible), (IMP) &hook_gesturePossible, NULL);
}