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.

76 lines
2.2KB

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