-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTweak.xm
109 lines (85 loc) · 2.48 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#import <SpringBoard/SpringBoard.h>
typedef struct SBIconCoordinate {
NSInteger row;
NSInteger col;
} SBIconCoordinate;
%group iOS13
%hook SBIconListGridLayoutConfiguration
- (NSUInteger)numberOfPortraitColumns {
NSUInteger rows = MSHookIvar<NSUInteger>(self, "_numberOfPortraitRows");
if (rows == 1)
return 5;
return %orig;
}
%end
%end
%group iOS12
%hook SBDockIconListView
+ (unsigned long long)maxIcons {
return 5;
}
-(unsigned long long)iconsInRowForSpacingCalculation {
return 5;
}
+(unsigned long long)iconColumnsForInterfaceOrientation:(long long)arg1 {
if (arg1 == 0) {
return 5;
} else {
return %orig;
}
}
%end
%end
%hook SBDockIconListView
-(CGPoint)originForIconAtCoordinate:(struct SBIconCoordinate)arg1 numberOfIcons:(unsigned long long)arg2 {
if (arg2 == 5) {
struct SBIconCoordinate cor1;
cor1.row = 1;
cor1.col = 1;
struct SBIconCoordinate cor2;
cor2.row = 1;
cor2.col = 2;
struct SBIconCoordinate cor3;
cor3.row = 1;
cor3.col = 3;
struct SBIconCoordinate cor4;
cor4.row = 1;
cor4.col = 4;
CGPoint originalPointForIcon1 = %orig(cor1, 4);
CGPoint originalPointForIcon2 = %orig(cor2, 4);
CGPoint originalPointForIcon3 = %orig(cor3, 4);
CGPoint originalPointForIcon4 = %orig(cor4, 4);
int defaultY = originalPointForIcon1.y;
int newIcon1X = originalPointForIcon1.x - (int)(originalPointForIcon1.x * 0.21);
int newIcon2X = originalPointForIcon2.x - (int)(originalPointForIcon2.x * 0.21);
int newIcon3X = originalPointForIcon3.x - (int)(originalPointForIcon3.x * 0.21);
int newIcon4X = originalPointForIcon4.x - (int)(originalPointForIcon4.x * 0.21);
int newIcon5X = originalPointForIcon4.x + (int)(originalPointForIcon4.x * 0.03);
if (arg1.col == 1) {
return CGPointMake(newIcon1X, defaultY);
}
else if (arg1.col == 2) {
return CGPointMake(newIcon2X, defaultY);
}
else if (arg1.col == 3) {
return CGPointMake(newIcon3X, defaultY);
}
else if (arg1.col == 4) {
return CGPointMake(newIcon4X, defaultY);
}
else {
return CGPointMake(newIcon5X, defaultY);
}
}
return %orig;
}
%end
%ctor {
%init;
if(kCFCoreFoundationVersionNumber < 1650) {
%init(iOS12);
}
else {
%init(iOS13);
}
}