ARCHS = arm64 arm64e | |||||
SDK = iPhoneOS13.0 | |||||
FINALPACKAGE = 1 | |||||
export TARGET = iphone:clang:13.0:latest | |||||
include $(THEOS)/makefiles/common.mk | |||||
TWEAK_NAME = ZenithDark | |||||
ZenithDark_FILES = Tweak.xm | |||||
ZenithDark_CFLAGS = -fobjc-arc | |||||
ZenithDark_FRAMEWORKS = UIKit CoreGraphics | |||||
include $(THEOS_MAKE_PATH)/tweak.mk | |||||
after-install:: | |||||
install.exec "sbreload" | |||||
SUBPROJECTS += zenithdarkprefs | |||||
include $(THEOS_MAKE_PATH)/aggregate.mk |
# ZenithDark | |||||
Dark tabs for Zenith! Availible on [mac-user669's repo](https://mac-user669.github.io/repo/) |
/* | |||||
Dark Mode for Zenith's Grabber view! | |||||
Copyright 2020 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC/iKilledAppl3 LLC. | |||||
All code was written for learning purposes and credit must be given to the original author. | |||||
Written for Cooper Hull, @(mac-user669). | |||||
*/ | |||||
#import "ZenithDark.h" | |||||
static BOOL enabled; | |||||
static void loadPrefs() { | |||||
static NSMutableDictionary *settings; | |||||
CFArrayRef keyList = CFPreferencesCopyKeyList(CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost); | |||||
if (keyList) { | |||||
settings = (NSMutableDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, CFSTR("com.mac-user669.zenithdarkprefs"), kCFPreferencesCurrentUser, kCFPreferencesAnyHost)); | |||||
CFRelease(keyList); | |||||
} else { | |||||
settings = [NSMutableDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.mac-user669.zenithdarkprefs.plist"]; | |||||
} | |||||
enabled = [([settings objectForKey:@"enabled"] ? [settings objectForKey:@"enabled"] : @(YES)) boolValue]; | |||||
} | |||||
// We then hook the class in this case Zenith's grabber view is called “ZNGrabberAccessoryView” | |||||
%hook ZNGrabberAccessoryView | |||||
// this is called when iOS 13's dark mode is enabled! | |||||
-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { | |||||
if (enabled) { | |||||
%orig(previousTraitCollection); | |||||
if (@available(iOS 13, *)) { | |||||
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | |||||
[self setBackgroundColor:kDarkModeColor]; | |||||
} | |||||
else { | |||||
[self setBackgroundColor:kLightModeColor]; | |||||
} | |||||
} | |||||
} | |||||
%orig; | |||||
} | |||||
// the method we modify is this method that is called from UIImageView to set the backgroundColor of the image view. | |||||
// Since the grabber view is of type UIImageView we can modify this method :) | |||||
-(void)setBackgroundColor:(UIColor *)backgroundColor { | |||||
if (enabled) { | |||||
// by default have our tweak overide this. | |||||
if (@available(iOS 13, *)) { | |||||
if (self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) { | |||||
%orig(kDarkModeColor); | |||||
} | |||||
else { | |||||
%orig; | |||||
} | |||||
} | |||||
} | |||||
%orig; | |||||
} | |||||
// we need to make sure we tell theos that we are finished hooking this class not doing so with cause the end of the world :P | |||||
%end | |||||
// our constructor | |||||
%ctor { | |||||
loadPrefs(); | |||||
// We use this to make sure we load Zenith's dynamic library at runtime so we can modify it with our tweak. | |||||
dlopen ("/Library/MobileSubstrate/DynamicLibraries/Zenith.dylib", RTLD_NOW); | |||||
} |
/* | |||||
Dark Mode for Zenith's Grabber view! | |||||
Copyright 2020 J.K. Hayslip (@iKilledAppl3) & ToxicAppl3 INSDC/iKilledAppl3 LLC. | |||||
All code was written for learning purposes and credit must be given to the original author. | |||||
Written for Cooper Hull, @(mac-user669). | |||||
ZenithDark Header file to keep the tweak.x file clean! | |||||
*/ | |||||
// We then import UIKit so we can override the color property without this Theos doesn't have a clue what those properties are. | |||||
@import UIKit; | |||||
// We make an interface to let Theos know that ZNGrabberAccessoryView is of type UIImageView. | |||||
@interface ZNGrabberAccessoryView : UIImageView | |||||
@end | |||||
// Dark Zenith color we are using macros so we can call it later if need be. | |||||
#define kDarkModeColor [UIColor colorWithWhite:0.0 alpha:0.44] | |||||
// Stock Zenith color we are using macros so we can call it later if need be. | |||||
#define kLightModeColor [UIColor colorWithWhite:1.0 alpha:0.7] |
{ Filter = { Bundles = ( "com.apple.springboard" ); }; } |
Package: com.mac-user669.zenithdark | |||||
Version: 1.0 | |||||
Architecture: iphoneos-arm | |||||
Maintainer: mac-user669 | |||||
Depends: mobilesubstrate, com.muirey03.zenith, firmware (>=13.0) | |||||
Section: Tweaks | |||||
Description: Changes Zeniths tabs to a dark blur | |||||
Author: mac-user669 | |||||
Name: ZenithDark | |||||
Sileodepiction: https://raw.githubusercontent.com/mac-user669/repo/master/sileodepictions/ZenithDark.json | |||||
Depiction: https://mac-user669.github.io/repo/depictions/?p=com.mac-user669.zenithdark/ |
include $(THEOS)/makefiles/common.mk | |||||
ARCHS = arm64 arm64e | |||||
export TARGET = iphone:clang:13.0:latest | |||||
BUNDLE_NAME = ZenithDarkPrefs | |||||
ZenithDarkPrefs_FILES = ZnthDrkRootListController.m | |||||
ZenithDarkPrefs_INSTALL_PATH = /Library/PreferenceBundles | |||||
ZenithDarkPrefs_FRAMEWORKS = UIKit | |||||
ZenithDarkPrefs_PRIVATE_FRAMEWORKS = Preferences | |||||
ZenithDarkPrefs_CFLAGS = -fobjc-arc | |||||
include $(THEOS_MAKE_PATH)/bundle.mk | |||||
internal-stage:: | |||||
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END) | |||||
$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/ZenithDarkPrefs.plist$(ECHO_END) |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>CFBundleDevelopmentRegion</key> | |||||
<string>English</string> | |||||
<key>CFBundleExecutable</key> | |||||
<string>ZenithDarkPrefs</string> | |||||
<key>CFBundleIdentifier</key> | |||||
<string>com.mac-user669.zenithdarkprefs</string> | |||||
<key>CFBundleInfoDictionaryVersion</key> | |||||
<string>6.0</string> | |||||
<key>CFBundlePackageType</key> | |||||
<string>BNDL</string> | |||||
<key>CFBundleShortVersionString</key> | |||||
<string>1.0.0</string> | |||||
<key>CFBundleSignature</key> | |||||
<string>????</string> | |||||
<key>CFBundleVersion</key> | |||||
<string>1.0</string> | |||||
<key>NSPrincipalClass</key> | |||||
<string>ZnthDrkRootListController</string> | |||||
</dict> | |||||
</plist> |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>items</key> | |||||
<array> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
<key>label</key> | |||||
<string>Enable</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSSwitchCell</string> | |||||
<key>default</key> | |||||
<true/> | |||||
<key>defaults</key> | |||||
<string>com.mac-user669.zenithdarkprefs</string> | |||||
<key>key</key> | |||||
<string>enabled</string> | |||||
<key>label</key> | |||||
<string>Enable</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSGroupCell</string> | |||||
</dict> | |||||
<dict> | |||||
<key>cell</key> | |||||
<string>PSButtonCell</string> | |||||
<key>label</key> | |||||
<string>@mac_user669</string> | |||||
<key>action</key> | |||||
<string>openTwitter</string> | |||||
</dict> | |||||
</array> | |||||
<key>title</key> | |||||
<string>ZenithDark</string> | |||||
</dict> | |||||
</plist> |
#import <Preferences/PSListController.h> | |||||
@interface ZnthDrkRootListController : PSListController | |||||
@end |
#import "ZnthDrkRootListController.h" | |||||
#import <spawn.h> | |||||
@implementation ZnthDrkRootListController | |||||
- (void)viewWillAppear:(BOOL)animated { | |||||
[super viewWillAppear:animated]; | |||||
UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respringDevice)]; | |||||
self.navigationItem.rightBarButtonItem = applyButton; | |||||
} | |||||
- (NSArray *)specifiers { | |||||
if (!_specifiers) { | |||||
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; | |||||
} | |||||
return _specifiers; | |||||
} | |||||
- (void) respringDevice { | |||||
UIAlertController *confirmRespringAlert = [UIAlertController alertControllerWithTitle:@"Apply settings?" message:@"This will respring your device" preferredStyle:UIAlertControllerStyleAlert]; | |||||
UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |||||
pid_t pid; | |||||
const char *argv[] = {"sbreload", NULL}; | |||||
posix_spawn(&pid, "/usr/bin/sbreload", NULL, NULL, (char* const*)argv, NULL); | |||||
}]; | |||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]; | |||||
[confirmRespringAlert addAction:cancel]; | |||||
[confirmRespringAlert addAction:confirm]; | |||||
[self presentViewController:confirmRespringAlert animated:YES completion:nil]; | |||||
} | |||||
-(void)openTwitter { | |||||
NSURL *twitter = [NSURL URLWithString:@"https://twitter.com/mac_user669"]; | |||||
[[UIApplication sharedApplication] openURL:twitter options:@{} completionHandler:nil]; | |||||
} | |||||
@end |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||||
<plist version="1.0"> | |||||
<dict> | |||||
<key>entry</key> | |||||
<dict> | |||||
<key>bundle</key> | |||||
<string>ZenithDarkPrefs</string> | |||||
<key>cell</key> | |||||
<string>PSLinkCell</string> | |||||
<key>detail</key> | |||||
<string>ZnthDrkRootListController</string> | |||||
<key>icon</key> | |||||
<string>icon.png</string> | |||||
<key>isController</key> | |||||
<true/> | |||||
<key>label</key> | |||||
<string>ZenithDarkPrefs</string> | |||||
</dict> | |||||
</dict> | |||||
</plist> |