The source code, duh.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3KB

  1. //Set up stuff
  2. //#import <SpringBoardHome/SBDockIconListView.h>
  3. //#import <SpringBoardHome/SBDockView.h>
  4. //#import <SpringBoardHome/SBIconListView.h>
  5. #import <Cephei/HBPreferences.h>
  6. @interface SBDockView
  7. @property (nonatomic, assign) double dockHeight;
  8. @end
  9. @interface SBDockIconListView
  10. @end
  11. @interface SBIconListView
  12. @end
  13. //Set up variables for use with Cephei
  14. static BOOL transparent;
  15. static BOOL hidden;
  16. static double setHeight;
  17. static double customOpacity;
  18. static NSInteger setIconNumber;
  19. HBPreferences *preferences;
  20. //hook the dock
  21. %hook SBDockView
  22. //this deals with everything adjusting opacity/transparency
  23. -(void)setBackgroundAlpha:(double)arg1 {
  24. if (transparent == NO && hidden == NO) { //if not transparent and not hidden
  25. %orig(customOpacity);
  26. }else if (transparent || hidden) { // Note: || means or in objc
  27. %orig(0.0); //hides background of the dock (transparent)
  28. } else {
  29. NSLog(@"Dock not Transparent/hidden, no custom opacity\n");
  30. }
  31. }
  32. //ios 12
  33. -(double)dockHeight {
  34. return (%orig*setHeight); //sets custom height if dock is not set to hidden
  35. }
  36. //ios 13
  37. +(double)defaultHeight {
  38. return (%orig*setHeight); //sets custom height if dock is not set to hidden
  39. }
  40. %end
  41. %hook SBDockIconListView
  42. +(NSInteger)maxIcons {
  43. if (hidden) {
  44. return (0);
  45. } else {
  46. return (setIconNumber);
  47. }
  48. }
  49. -(BOOL)allowsAddingIconCount:(unsigned long long)arg1 {
  50. if (hidden) {
  51. return (0);
  52. %orig(NO);
  53. } else {
  54. %orig(YES);
  55. return (setIconNumber);
  56. }
  57. }
  58. %end
  59. %ctor {
  60. preferences = [[HBPreferences alloc] initWithIdentifier:@"com.burritoz.dockifyprefs"];
  61. [preferences registerDefaults:@{ //defaults for prefernces
  62. @"setHeight": @1,
  63. @"customOpacity": @1,
  64. @"hidden": @NO,
  65. @"setIconNumber": @4,
  66. }];
  67. [preferences registerBool:&transparent default:YES forKey:@"transparent"]; //registering transparent as a Boolean
  68. [preferences registerBool:&hidden default:NO forKey:@"hidden"]; //registering hidden as a Boolean
  69. [preferences registerDouble:(double *)&setHeight default:1 forKey:@"setHeight"]; //registering setHeigt as a double (number)
  70. [preferences registerDouble:(double *)&customOpacity default:1 forKey:@"customOpacity"]; //registering customOpacity as a double (number)
  71. [preferences registerInteger:(NSInteger *)&setIconNumber default:4 forKey:@"setIconNumber"]; //Integer of how many icons to allow
  72. }