Tweak to change opacity of dock. Includes experimental “classic” dock setting for botched devices. I intend to make this a more full fledged dock-customization tweak in the future.
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.

34 lines
1.3KB

  1. %hook SBDockView
  2. -(void)setBackgroundAlpha:(double)arg1 { // Method found in SBDockView.h used to set dock opacity
  3. // Preferences
  4. NSDictionary *bundleDefaults = [[NSUserDefaults standardUserDefaults]
  5. persistentDomainForName:@"com.exoticswingset.truthfuldockprefs"];
  6. id isTweakEnabled = [bundleDefaults valueForKey:@"isTweakEnabled"];
  7. double alphaValue = [[bundleDefaults valueForKey:@"alphaValue"]doubleValue];
  8. if ([isTweakEnabled isEqual:@0]) { // Checks if tweak is disabled
  9. %orig;
  10. } else {
  11. %orig(alphaValue); // %orig executes all of the other code that originally would have ran, but inside the parentheses is where arg1, a double is passed through instead of the default.
  12. }
  13. }
  14. -(BOOL)isDockInset { // BOOL found in SBDockView.h. If set to NO, dock no longer appears round on notched iPhones.
  15. // Preferences
  16. NSDictionary *bundleDefaults = [[NSUserDefaults standardUserDefaults]persistentDomainForName:@"com.exoticswingset.truthfuldockprefs"];
  17. id isTweakEnabled = [bundleDefaults valueForKey:@"isTweakEnabled"];
  18. id classicDockEnabled = [bundleDefaults valueForKey:@"classicDockEnabled"];
  19. if ([isTweakEnabled isEqual:@0]) {
  20. return %orig;
  21. } else if ([classicDockEnabled isEqual:@0]) {
  22. return %orig;
  23. } else {
  24. return NO;
  25. }
  26. }
  27. %end