From 998651a333f775ef10815fa3874914720f8a7714 Mon Sep 17 00:00:00 2001 From: Viggo Lekdorf Date: Fri, 3 Jan 2020 01:00:11 +0100 Subject: [PATCH] add stuff --- Makefile | 14 +++++++ README.md | 2 + SquareSwitcherX.plist | 1 + Tweak.xm | 32 ++++++++++++++++ control | 10 +++++ squareswitcherxprefs/Makefile | 16 ++++++++ squareswitcherxprefs/Resources/Info.plist | 24 ++++++++++++ squareswitcherxprefs/Resources/Root.plist | 39 ++++++++++++++++++++ squareswitcherxprefs/SSXRootListController.h | 7 ++++ squareswitcherxprefs/SSXRootListController.m | 20 ++++++++++ squareswitcherxprefs/entry.plist | 21 +++++++++++ 11 files changed, 186 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 SquareSwitcherX.plist create mode 100644 Tweak.xm create mode 100644 control create mode 100644 squareswitcherxprefs/Makefile create mode 100644 squareswitcherxprefs/Resources/Info.plist create mode 100644 squareswitcherxprefs/Resources/Root.plist create mode 100644 squareswitcherxprefs/SSXRootListController.h create mode 100644 squareswitcherxprefs/SSXRootListController.m create mode 100644 squareswitcherxprefs/entry.plist diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cac91e7 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +ARCHS = arm64 +TARGET = iphone:clang:11.2:11.2 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = SquareSwitcherX +SquareSwitcherX_FILES = Tweak.xm + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 SpringBoard" +SUBPROJECTS += squareswitcherxprefs +include $(THEOS_MAKE_PATH)/aggregate.mk diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5d3c72 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# SquareSwitcherX +Reduce corner radius on iPhone X app switcher cards diff --git a/SquareSwitcherX.plist b/SquareSwitcherX.plist new file mode 100644 index 0000000..10dc654 --- /dev/null +++ b/SquareSwitcherX.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.springboard" ); }; } diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..4ed3acf --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,32 @@ +// Define the path to our preference plist +#define PLIST_PATH @"/var/mobile/Library/Preferences/com.yaypixxo.squareswitcherxprefs.plist" + +// Create a method we'll use to get the bool value of the enable switch +inline bool GetPrefBool(NSString *key) { +return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue]; +} + +// What to modify +@interface SBAppSwitcherPageView : UIView +@property (assign,nonatomic) double cornerRadius; +-(void)_updateCornerRadius; +@end + +// Hook into header +%hook SBAppSwitcherPageView + +-(void)_updateCornerRadius { +// Check if enable switch is on (using the method we created earlier) +if (GetPrefBool(@"enabled")) { + // Change corner radius + %orig; + self.cornerRadius = 5; +} +// If the enable switch is off, don't modify +else { + %orig; +} +} + +// And cleanup +%end diff --git a/control b/control new file mode 100644 index 0000000..9ff39a9 --- /dev/null +++ b/control @@ -0,0 +1,10 @@ +Package: com.yaypixxo.squareswitcherx +Name: SquareSwitcherX +Depends: mobilesubstrate, preferenceloader +Version: 1.1.1 +Architecture: iphoneos-arm +Description: Reduce corner radius of iPhone X switcher cards +Depiction: http://yaypixxo.com/depictions?p=com.yaypixxo.squareswitcherx +Maintainer: YaYPIXXO +Author: YaYPIXXO +Section: Tweaks diff --git a/squareswitcherxprefs/Makefile b/squareswitcherxprefs/Makefile new file mode 100644 index 0000000..b99f952 --- /dev/null +++ b/squareswitcherxprefs/Makefile @@ -0,0 +1,16 @@ +ARCHS = arm64 +TARGET = iphone:clang:11.2:11.2 + +include $(THEOS)/makefiles/common.mk + +BUNDLE_NAME = SquareSwitcherXPrefs +SquareSwitcherXPrefs_FILES = SSXRootListController.m +SquareSwitcherXPrefs_INSTALL_PATH = /Library/PreferenceBundles +SquareSwitcherXPrefs_FRAMEWORKS = UIKit +SquareSwitcherXPrefs_PRIVATE_FRAMEWORKS = Preferences + +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/SquareSwitcherXPrefs.plist$(ECHO_END) diff --git a/squareswitcherxprefs/Resources/Info.plist b/squareswitcherxprefs/Resources/Info.plist new file mode 100644 index 0000000..6482b4f --- /dev/null +++ b/squareswitcherxprefs/Resources/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + SquareSwitcherXPrefs + CFBundleIdentifier + com.yaypixxo.squareswitcherxprefs + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + SSXRootListController + + diff --git a/squareswitcherxprefs/Resources/Root.plist b/squareswitcherxprefs/Resources/Root.plist new file mode 100644 index 0000000..74b2622 --- /dev/null +++ b/squareswitcherxprefs/Resources/Root.plist @@ -0,0 +1,39 @@ + + + + + items + + + cell + PSSwitchCell + default + + defaults + com.yaypixxo.squareswitcherxprefs + key + enabled + label + Enable + + + action + respring: + cell + PSButtonCell + label + Respring + + + cell + PSGroupCell + footerText + SquareSwitcherX by YaYPIXXO + isStaticText + + + + title + SquareSwitcherX + + diff --git a/squareswitcherxprefs/SSXRootListController.h b/squareswitcherxprefs/SSXRootListController.h new file mode 100644 index 0000000..f1daa2c --- /dev/null +++ b/squareswitcherxprefs/SSXRootListController.h @@ -0,0 +1,7 @@ +#import +#import +#import + +@interface SSXRootListController : PSListController + +@end diff --git a/squareswitcherxprefs/SSXRootListController.m b/squareswitcherxprefs/SSXRootListController.m new file mode 100644 index 0000000..4b5413c --- /dev/null +++ b/squareswitcherxprefs/SSXRootListController.m @@ -0,0 +1,20 @@ +#include "SSXRootListController.h" + +@implementation SSXRootListController + +- (NSArray *)specifiers { + if (!_specifiers) { + _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain]; + } + + return _specifiers; +} + +// Respring function +- (void)respring:(id)sender { + pid_t pid; + const char* args[] = {"killall", "backboardd", NULL}; + posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL); +} + +@end diff --git a/squareswitcherxprefs/entry.plist b/squareswitcherxprefs/entry.plist new file mode 100644 index 0000000..b3aba07 --- /dev/null +++ b/squareswitcherxprefs/entry.plist @@ -0,0 +1,21 @@ + + + + + entry + + bundle + SquareSwitcherXPrefs + cell + PSLinkCell + detail + SSXRootListController + icon + icon.png + isController + + label + SquareSwitcherX + + +