-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
34 lines (26 loc) · 922 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
// Created by J.K. Hayslip (iKilledAppl3) on November 18,2019
// Pretty simple code :P
// Anyways here have fun!
#import "HideMyDockTV_header.h"
// This is the dock view :P
%hook HBUIMainAppGridDockView
-(void)layoutSubviews {
if (kEnabled) {
%orig;
[self removeFromSuperview];
}
else {
%orig;
}
}
%end
// Load preferences to make sure changes are written to the plist
static void loadPrefs() {
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:PLIST_PATH];
//our preference values that write to a plist file when a user selects somethings
kEnabled = [([prefs objectForKey:@"kEnabled"] ?: @(YES)) boolValue];
}
%ctor {
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback) loadPrefs, CFSTR("com.ikilledappl3.hidemydocktv.prefschanged"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
loadPrefs();
}