From 2da7325a5d433f36913dca00a80c266c297ba10a Mon Sep 17 00:00:00 2001 From: lillian rose winter Date: Mon, 25 Nov 2019 08:53:53 -0600 Subject: [PATCH] :tada: first commit --- Headers.h | 16 +++++ Makefile | 14 +++++ Tweak.x | 84 ++++++++++++++++++++++++++ control | 9 +++ hanahaki.plist | 1 + hanahakiprefs/HANARootListController.h | 9 +++ hanahakiprefs/HANARootListController.m | 20 ++++++ hanahakiprefs/Makefile | 15 +++++ hanahakiprefs/Resources/Info.plist | 24 ++++++++ hanahakiprefs/Resources/Root.plist | 61 +++++++++++++++++++ hanahakiprefs/entry.plist | 21 +++++++ 11 files changed, 274 insertions(+) create mode 100644 Headers.h create mode 100644 Makefile create mode 100644 Tweak.x create mode 100644 control create mode 100644 hanahaki.plist create mode 100644 hanahakiprefs/HANARootListController.h create mode 100644 hanahakiprefs/HANARootListController.m create mode 100644 hanahakiprefs/Makefile create mode 100644 hanahakiprefs/Resources/Info.plist create mode 100644 hanahakiprefs/Resources/Root.plist create mode 100644 hanahakiprefs/entry.plist diff --git a/Headers.h b/Headers.h new file mode 100644 index 0000000..c5a3c83 --- /dev/null +++ b/Headers.h @@ -0,0 +1,16 @@ +#import +#import +#import + +@interface _UIBackdropView : UIView {} +@end + +@interface SBFloatingDockPlatterView : UIView + @property (nonatomic, retain) _UIBackdropView * backgroundView; +@end + +@interface _UIRootWindow : UIView + @property (setter=_setContinuousCornerRadius:, nonatomic) double _continuousCornerRadius; + - (double)_continuousCornerRadius; + - (void)_setContinuousCornerRadius:(double)arg1; +@end diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..34e1267 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +INSTALL_TARGET_PROCESSES = SpringBoard + +THEOS_DEVICE_IP = 172.20.10.1 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = hanahaki + +hanahaki_FILES = Tweak.x +hanahaki_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/tweak.mk +SUBPROJECTS += hanahakiprefs +include $(THEOS_MAKE_PATH)/aggregate.mk diff --git a/Tweak.x b/Tweak.x new file mode 100644 index 0000000..090dc0e --- /dev/null +++ b/Tweak.x @@ -0,0 +1,84 @@ +// 888 888 888 d8b +// 888 888 888 Y8P +// 888 888 888 +// 88888b. 8888b. 88888b. 8888b. 88888b. 8888b. 888 888 888 +// 888 "88b "88b 888 "88b "88b 888 "88b "88b 888 .88P 888 +// 888 888 .d888888 888 888 .d888888 888 888 .d888888 888888K 888 +// 888 888 888 888 888 888 888 888 888 888 888 888 888 "88b 888 +// 888 888 "Y888888 888 888 "Y888888 888 888 "Y888888 888 888 888 +// +// (c) lillian rose winter 2019, all rights reserved or whateva + +#import "Headers.h" + +%hook NSObject +@interface NSObject (customObject) +- (BOOL)isSettingOn:(NSString *)keyStr; +@end + +%new +- (BOOL)isSettingOn:(NSString *)keyStr { + const char *keyStrC = [keyStr cStringUsingEncoding:NSUTF8StringEncoding]; + CFPreferencesAppSynchronize(CFSTR("toys.lily.hanahakiprefs")); + CFPropertyListRef value = CFPreferencesCopyAppValue(CFStringCreateWithCString(NULL, keyStrC, kCFStringEncodingUTF8), CFSTR("toys.lily.hanahakiprefs")); + + NSString *valueString = [NSString stringWithFormat:@"%@", value]; + NSString *noVal = @"0"; + + if ([valueString isEqualToString:noVal]) { + return NO; + } + else { + return YES; + } +} +%end + +//DOCK BG + +%hook SBDockView +- (void)setBackgroundAlpha:(double)arg1 { + NSObject *object = [[NSObject alloc] init]; + BOOL isSettingOn = [object isSettingOn:@"dockbg"]; + + if (isSettingOn) { + arg1 = 0; + } + + else { + arg1 = 1; + } + + %orig(arg1); +} +%end + +%hook SBFloatingDockPlatterView +- (void)layoutSubviews { + NSObject *object = [[NSObject alloc] init]; + BOOL isSettingOn = [object isSettingOn:@"dockbg"]; + + %orig; + + if(isSettingOn) { + self.backgroundView = nil; + } +} +%end + +//SCREEN BORDERS + +%hook _UIRootWindow +- (void)layoutSubviews { + NSObject *object = [[NSObject alloc] init]; + BOOL isSettingOn = [object isSettingOn:@"borders"]; + + %orig; + + if(isSettingOn) { + self._continuousCornerRadius = 10; + self.clipsToBounds = YES; + } + return; +} +%end diff --git a/control b/control new file mode 100644 index 0000000..64acbac --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: toys.lily.hanahaki +Name: hanahaki +Depends: mobilesubstrate +Version: 0.0.1 +Architecture: iphoneos-arm +Description: An awesome MobileSubstrate tweak! +Maintainer: lillian rose winter +Author: lillian rose winter +Section: Tweaks diff --git a/hanahaki.plist b/hanahaki.plist new file mode 100644 index 0000000..10dc654 --- /dev/null +++ b/hanahaki.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.springboard" ); }; } diff --git a/hanahakiprefs/HANARootListController.h b/hanahakiprefs/HANARootListController.h new file mode 100644 index 0000000..5fa2425 --- /dev/null +++ b/hanahakiprefs/HANARootListController.h @@ -0,0 +1,9 @@ +#import +#import +#include + +@interface HANARootListController : PSListController + +- (void)respring; + +@end diff --git a/hanahakiprefs/HANARootListController.m b/hanahakiprefs/HANARootListController.m new file mode 100644 index 0000000..dbe2060 --- /dev/null +++ b/hanahakiprefs/HANARootListController.m @@ -0,0 +1,20 @@ +#include "HANARootListController.h" + +@implementation HANARootListController + +- (NSArray *)specifiers { + if (!_specifiers) { + _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self]; + } + + return _specifiers; +} + +- (void)respring { + pid_t respringPid; + char *respringArgv[] = {"/usr/bin/killall", (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_6_0) ? "backboardd" : "SpringBoard", NULL}; + posix_spawn(&respringPid, respringArgv[0], NULL, NULL, respringArgv, NULL); + waitpid(respringPid, NULL, WEXITED); +} + +@end diff --git a/hanahakiprefs/Makefile b/hanahakiprefs/Makefile new file mode 100644 index 0000000..4c21eed --- /dev/null +++ b/hanahakiprefs/Makefile @@ -0,0 +1,15 @@ +include $(THEOS)/makefiles/common.mk + +BUNDLE_NAME = hanahakiprefs + +hanahakiprefs_FILES = HANARootListController.m +hanahakiprefs_INSTALL_PATH = /Library/PreferenceBundles +hanahakiprefs_FRAMEWORKS = UIKit +hanahakiprefs_PRIVATE_FRAMEWORKS = Preferences +hanahakiprefs_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/hanahakiprefs.plist$(ECHO_END) diff --git a/hanahakiprefs/Resources/Info.plist b/hanahakiprefs/Resources/Info.plist new file mode 100644 index 0000000..dbef028 --- /dev/null +++ b/hanahakiprefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + hanahakiprefs + CFBundleIdentifier + toys.lily.hanahakiprefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + HANARootListController + + diff --git a/hanahakiprefs/Resources/Root.plist b/hanahakiprefs/Resources/Root.plist new file mode 100644 index 0000000..24c1073 --- /dev/null +++ b/hanahakiprefs/Resources/Root.plist @@ -0,0 +1,61 @@ + + + + + items + + + cell + PSGroupCell + label + respring to apply changes + + + cell + PSButtonCell + action + respring + label + respring + + + cell + PSGroupCell + label + global + + + cell + PSSwitchCell + default + + defaults + toys.lily.hanahakiprefs + key + borders + label + rounded screen corners + + + cell + PSGroupCell + label + home screen + + + cell + PSSwitchCell + default + + defaults + toys.lily.hanahakiprefs + key + dockbg + label + remove dock background + + + title + hanahaki + + diff --git a/hanahakiprefs/entry.plist b/hanahakiprefs/entry.plist new file mode 100644 index 0000000..0458292 --- /dev/null +++ b/hanahakiprefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + hanahakiprefs + cell + PSLinkCell + detail + HANARootListController + icon + icon.png + isController + + label + hanahaki + + +