summaryrefslogtreecommitdiffstats
path: root/BatteryPercent/Tweak.x
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-08-09 14:34:37 -0400
committerCameron Katri <me@cameronkatri.com>2021-08-09 14:34:37 -0400
commitaf6c94ec8564d0c7f9b12d4d5738a8a4113c0006 (patch)
tree1bc06561aa8a0b613bf81999382ea7b44fb9a470 /BatteryPercent/Tweak.x
parent027b91b5542974670fc4186a717634d347c98df2 (diff)
downloadtweaks-af6c94ec8564d0c7f9b12d4d5738a8a4113c0006.tar.gz
tweaks-af6c94ec8564d0c7f9b12d4d5738a8a4113c0006.zip
BatteryPercent: Make battery outline green when charging
Diffstat (limited to 'BatteryPercent/Tweak.x')
-rw-r--r--BatteryPercent/Tweak.x19
1 files changed, 19 insertions, 0 deletions
diff --git a/BatteryPercent/Tweak.x b/BatteryPercent/Tweak.x
index b1f7c74..47241ef 100644
--- a/BatteryPercent/Tweak.x
+++ b/BatteryPercent/Tweak.x
@@ -1,3 +1,10 @@
+@interface _UIBatteryView : UIView
+@property (assign,nonatomic) double bodyColorAlpha;
+@property (assign,nonatomic) double pinColorAlpha;
+-(void)setBodyColor:(UIColor *)arg1;
+-(void)setPinColor:(UIColor *)arg1;
+@end
+
%hook _UIBatteryView
-(void)setShowsPercentage:(BOOL)enabled
@@ -10,6 +17,18 @@
%orig(false);
}
+-(void)setChargingState:(NSInteger)state
+{
+ %orig;
+ if (state) {
+ [self setBodyColor:[UIColor systemGreenColor]];
+ [self setPinColor:[UIColor systemGreenColor]];
+ } else {
+ [self setBodyColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.bodyColorAlpha]];
+ [self setPinColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.pinColorAlpha]];
+ }
+}
+
%end
// vim: filetype=logos