-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
47 lines (32 loc) · 1.12 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
//
// Tweak.xm
//
// Created by Cole Cabral on 2015-09-06.
// Copyright (c) 2015 Cole Cabral. All rights reserved.
//
// Thanks angelXwind for the examples in PreferenceOrganizer2!
#import "MapsCommon.h"
#define MapsPreferencePath @"/User/Library/Preferences/com.cabralcole.mapssbhidden.plist"
#define MapsObserver(funcToCall, listener) CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)funcToCall, CFSTR(listener), NULL, CFNotificationSuspensionBehaviorCoalesce);
static BOOL MapsSBHiddenOption;
static void mapsInitPrefs() {
NSDictionary *mapsSettings = [NSDictionary dictionaryWithContentsOfFile:MapsPreferencePath];
NSNumber *mapsOptionKey = mapsSettings[@"enabled"];
MapsSBHiddenOption = mapsOptionKey ? [mapsOptionKey boolValue] :1;
}
static void killMaps() {
system("/usr/bin/killall -9 Maps");
}
%ctor {
mapsInitPrefs();
MapsObserver (mapsInitPrefs, "com.cabralcole.mapssbhidden-PreferencesChanged");
}
%hook MainChromeViewController
- (_Bool)prefersStatusBarHidden { // Hides status bar
if (MapsSBHiddenOption) {
return 1;
} else {
return 0;
}
}
%end