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.

117 lines
6.2KB

  1. #line 1 "Tweak.x"
  2. #import <Cephei/HBPreferences.h>
  3. @interface SBDockView
  4. @property (nonatomic, assign) double dockHeight;
  5. @end
  6. @interface SBDockIconListView
  7. @end
  8. @interface SBIconListView
  9. @end
  10. static BOOL transparent;
  11. static BOOL hidden;
  12. static double setHeight;
  13. static double customOpacity;
  14. static NSInteger setIconNumber;
  15. HBPreferences *preferences;
  16. #include <substrate.h>
  17. #if defined(__clang__)
  18. #if __has_feature(objc_arc)
  19. #define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
  20. #define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
  21. #define _LOGOS_SELF_CONST const
  22. #define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
  23. #else
  24. #define _LOGOS_SELF_TYPE_NORMAL
  25. #define _LOGOS_SELF_TYPE_INIT
  26. #define _LOGOS_SELF_CONST
  27. #define _LOGOS_RETURN_RETAINED
  28. #endif
  29. #else
  30. #define _LOGOS_SELF_TYPE_NORMAL
  31. #define _LOGOS_SELF_TYPE_INIT
  32. #define _LOGOS_SELF_CONST
  33. #define _LOGOS_RETURN_RETAINED
  34. #endif
  35. @class SBDockView; @class SBDockIconListView;
  36. static void (*_logos_orig$_ungrouped$SBDockView$setBackgroundAlpha$)(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST, SEL, double); static void _logos_method$_ungrouped$SBDockView$setBackgroundAlpha$(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST, SEL, double); static double (*_logos_orig$_ungrouped$SBDockView$dockHeight)(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST, SEL); static double _logos_method$_ungrouped$SBDockView$dockHeight(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST, SEL); static double (*_logos_meta_orig$_ungrouped$SBDockView$defaultHeight)(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST, SEL); static double _logos_meta_method$_ungrouped$SBDockView$defaultHeight(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST, SEL); static NSInteger (*_logos_meta_orig$_ungrouped$SBDockIconListView$maxIcons)(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST, SEL); static NSInteger _logos_meta_method$_ungrouped$SBDockIconListView$maxIcons(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST, SEL); static BOOL (*_logos_orig$_ungrouped$SBDockIconListView$allowsAddingIconCount$)(_LOGOS_SELF_TYPE_NORMAL SBDockIconListView* _LOGOS_SELF_CONST, SEL, unsigned long long); static BOOL _logos_method$_ungrouped$SBDockIconListView$allowsAddingIconCount$(_LOGOS_SELF_TYPE_NORMAL SBDockIconListView* _LOGOS_SELF_CONST, SEL, unsigned long long);
  37. #line 27 "Tweak.x"
  38. static void _logos_method$_ungrouped$SBDockView$setBackgroundAlpha$(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, double arg1) {
  39. if (transparent == NO && hidden == NO) {
  40. _logos_orig$_ungrouped$SBDockView$setBackgroundAlpha$(self, _cmd, customOpacity);
  41. }else if (transparent || hidden) {
  42. _logos_orig$_ungrouped$SBDockView$setBackgroundAlpha$(self, _cmd, 0.0);
  43. } else {
  44. NSLog(@"Dock not Transparent/hidden, no custom opacity\n");
  45. }
  46. }
  47. static double _logos_method$_ungrouped$SBDockView$dockHeight(_LOGOS_SELF_TYPE_NORMAL SBDockView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  48. return (_logos_orig$_ungrouped$SBDockView$dockHeight(self, _cmd)*setHeight);
  49. }
  50. static double _logos_meta_method$_ungrouped$SBDockView$defaultHeight(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  51. return (_logos_meta_orig$_ungrouped$SBDockView$defaultHeight(self, _cmd)*setHeight);
  52. }
  53. static NSInteger _logos_meta_method$_ungrouped$SBDockIconListView$maxIcons(_LOGOS_SELF_TYPE_NORMAL Class _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
  54. if (hidden) {
  55. return (0);
  56. } else {
  57. return (setIconNumber);
  58. }
  59. }
  60. static BOOL _logos_method$_ungrouped$SBDockIconListView$allowsAddingIconCount$(_LOGOS_SELF_TYPE_NORMAL SBDockIconListView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, unsigned long long arg1) {
  61. if (hidden) {
  62. return (0);
  63. _logos_orig$_ungrouped$SBDockIconListView$allowsAddingIconCount$(self, _cmd, NO);
  64. } else {
  65. _logos_orig$_ungrouped$SBDockIconListView$allowsAddingIconCount$(self, _cmd, YES);
  66. return (setIconNumber);
  67. }
  68. }
  69. static __attribute__((constructor)) void _logosLocalCtor_4c282753(int __unused argc, char __unused **argv, char __unused **envp) {
  70. preferences = [[HBPreferences alloc] initWithIdentifier:@"com.burritoz.dockifyprefs"];
  71. [preferences registerDefaults:@{
  72. @"setHeight": @1,
  73. @"customOpacity": @1,
  74. @"hidden": @NO,
  75. @"setIconNumber": @4,
  76. }];
  77. [preferences registerBool:&transparent default:YES forKey:@"transparent"];
  78. [preferences registerBool:&hidden default:NO forKey:@"hidden"];
  79. [preferences registerDouble:(double *)&setHeight default:1 forKey:@"setHeight"];
  80. [preferences registerDouble:(double *)&customOpacity default:1 forKey:@"customOpacity"];
  81. [preferences registerInteger:(NSInteger *)&setIconNumber default:4 forKey:@"setIconNumber"];
  82. }
  83. static __attribute__((constructor)) void _logosLocalInit() {
  84. {Class _logos_class$_ungrouped$SBDockView = objc_getClass("SBDockView"); Class _logos_metaclass$_ungrouped$SBDockView = object_getClass(_logos_class$_ungrouped$SBDockView); MSHookMessageEx(_logos_class$_ungrouped$SBDockView, @selector(setBackgroundAlpha:), (IMP)&_logos_method$_ungrouped$SBDockView$setBackgroundAlpha$, (IMP*)&_logos_orig$_ungrouped$SBDockView$setBackgroundAlpha$);MSHookMessageEx(_logos_class$_ungrouped$SBDockView, @selector(dockHeight), (IMP)&_logos_method$_ungrouped$SBDockView$dockHeight, (IMP*)&_logos_orig$_ungrouped$SBDockView$dockHeight);MSHookMessageEx(_logos_metaclass$_ungrouped$SBDockView, @selector(defaultHeight), (IMP)&_logos_meta_method$_ungrouped$SBDockView$defaultHeight, (IMP*)&_logos_meta_orig$_ungrouped$SBDockView$defaultHeight);Class _logos_class$_ungrouped$SBDockIconListView = objc_getClass("SBDockIconListView"); Class _logos_metaclass$_ungrouped$SBDockIconListView = object_getClass(_logos_class$_ungrouped$SBDockIconListView); MSHookMessageEx(_logos_metaclass$_ungrouped$SBDockIconListView, @selector(maxIcons), (IMP)&_logos_meta_method$_ungrouped$SBDockIconListView$maxIcons, (IMP*)&_logos_meta_orig$_ungrouped$SBDockIconListView$maxIcons);MSHookMessageEx(_logos_class$_ungrouped$SBDockIconListView, @selector(allowsAddingIconCount:), (IMP)&_logos_method$_ungrouped$SBDockIconListView$allowsAddingIconCount$, (IMP*)&_logos_orig$_ungrouped$SBDockIconListView$allowsAddingIconCount$);} }
  85. #line 88 "Tweak.x"