-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTweak.xm
35 lines (27 loc) · 855 Bytes
/
Tweak.xm
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
#import "QuickSearchWindow.h"
static QuickSearchWindow *mainWindow = nil;
%hook SpringBoard
// setup the window when springboard is launched
-(void)applicationDidFinishLaunching:(id)arg1 {
%orig;
// create the window
mainWindow = [[QuickSearchWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
// toggle the window when both volume buttons are pressed
-(_Bool)_handlePhysicalButtonEvent:(UIPressesEvent *)event {
if (!mainWindow) return %orig;
UIPress *volUp = nil;
UIPress *volDown = nil;
for (UIPress *press in [[event allPresses] allObjects]) {
if (press.type == 102 && press.force == 1) { // volume up
volUp = press;
} else if (press.type == 103 && press.force == 1) { // volume down
volDown = press;
}
}
if (volUp && volDown) {
[mainWindow toggle];
}
return %orig;
}
%end