Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: a setting that waits on a switch stays grayed out under it, and a tap on it nudges the switch

My-Name-Is-Jeff145f6fd3d634
diff --git a/docs/tweaks.md b/docs/tweaks.md
index 2099a174..c36d4526 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -8,8 +8,9 @@
functions Spotify imports hooked by rebinding its import slots (SGRebind.h)
tweak/Sources/Headers/ reverse-engineered Spotify classes, one header each, only the selectors used
tweak/Sources/Settings/ the Mod Settings framework: SGPage (a page on Spotify's stack), SGModPage (sections
- of rows: switches, choices, sliders, links, and rows shown only while a switch
- is on), SGPageStyle (Spotify's list look), SGGlowSwitch
+ of rows: switches, choices, sliders, links, rows shown only while a choice
+ asks for them, and rows greyed out while the switch they wait on is off, a tap
+ on one nudging that switch), SGPageStyle (Spotify's list look), SGGlowSwitch
tweak/Sources/Shared/ what works the same with either look, see Layers below
tweak/Sources/Native/ tweaks on Spotify's own screens, running only while Redesigned UI is off
tweak/Sources/Redesigned/ the redesign, running only while Redesigned UI is on
@@ -442,7 +443,7 @@ chosen, and the now playing bar's device button, checked in the simulator agains
Controls (on until switched off) and one for Music Haptics, a choice of None, Generated or Native iOS
(left out below iOS 18) with an ⓘ saying what each does. Someone with no choice stored gets Native iOS
when Music Haptics is on in Accessibility, else Generated if the old switch was on, else None. Controls
-opens out while its switch is on into its Strength (10 to 100%, a tap at the new strength with each step);
+has its Strength under it, greyed out while the switch is off (10 to 100%, a tap at the new strength with each step);
Generated into its Strength (20 to 200%, 100% being how it first shipped) and Follows, Everything (a tap on
each kick and snare and a rumble under the bass), Beat (the taps without the rumble) or Bass (the kicks'
taps and the rumble); Native iOS into a Status row (Off in iOS, Paused, Waiting, Checking, Ready, Playing
diff --git a/harness/haptics-page/README.md b/harness/haptics-page/README.md
index 35a3ad5b..f968e6dd 100644
--- a/harness/haptics-page/README.md
+++ b/harness/haptics-page/README.md
@@ -25,4 +25,8 @@ fading in under a switch (`slow`); Controls at 40%, Music Haptics at 150% then 1
under their keys and read back by the hooks. The Audio effects page and an SGModPage without shown-while rows
(`harness/audio-effects-page`, `push=reference`) draw the same pixels as before the slider and visibility were added.
+2026-10-05, iPhone 17 Pro on iOS 27.0: with `controls-off` the Strength row stays under Controls, greyed (`dump` marks
+it), `select=2.1` on it leans the Controls switch 6pt towards on and springs it back, and `toggle=2.0` brings
+Strength back to full strength without a row moving.
+
What it does not cover: a real finger on the slider, and how any strength feels, which only a phone can tell.
diff --git a/harness/haptics-page/main.m b/harness/haptics-page/main.m
index e555778c..7f5750c7 100644
--- a/harness/haptics-page/main.m
+++ b/harness/haptics-page/main.m
@@ -151,7 +151,8 @@ static void findViews(UIView *root, Class kind, NSMutableArray *found) {
NSString *title = [(UIListContentConfiguration *)cell.contentConfiguration text];
NSMutableArray<UILabel *> *labels = [NSMutableArray array];
if (!title) findViews(cell.contentView, UILabel.class, labels);
- [rows addObject:[NSString stringWithFormat:@"%@ (%.0fpt)", title ?: labels.firstObject.text ?: @"?", [table rectForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section]].size.height]];
+ [rows addObject:[NSString stringWithFormat:@"%@ (%.0fpt%@)", title ?: labels.firstObject.text ?: @"?", [table rectForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section]].size.height,
+ cell.contentView.alpha < 1 ? @", greyed" : @""]];
}
NSLog(@"[harness] section %ld: %@", (long)section, [rows componentsJoinedByString:@", "]);
}
diff --git a/tweak/Sources/Settings/SGModPage.h b/tweak/Sources/Settings/SGModPage.h
index 5c7a636b..792f7472 100644
--- a/tweak/Sources/Settings/SGModPage.h
+++ b/tweak/Sources/Settings/SGModPage.h
@@ -28,8 +28,11 @@
@property (nonatomic, copy) NSString *info;
// The row shows only while this answers YES, asked again whenever a switch on the page is flipped, the
// page comes back from a choice's list or it is told to (-refreshVisibility): the row fades in or out where
-// it sits. Nil shows it always.
+// it sits. Nil shows it always. A row that only waits on a switch takes `waitsOn` instead.
@property (nonatomic, copy) BOOL (^visible)(void);
+// The key of a switch row on the same page this row works under: while that switch is off the row stays
+// where it is, greyed out, and a tap on it nudges the switch.
+@property (nonatomic, copy) NSString *waitsOn;
// A choice row's: a line under each name in its list, in the same order, and what runs once one is stored.
@property (nonatomic, copy) NSArray<NSString *> *choiceNotes;
@property (nonatomic, copy) NSString *choiceFooter; // under a choice row's list
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index 360c97fb..55ef38db 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -443,6 +443,8 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
- (void)showRow:(SGModRow *)row {
_row = row;
+ _slider.enabled = YES; // a row waiting on a switch turns it off again (showWaiting)
+ _slider.userInteractionEnabled = YES;
NSInteger count = row.step > 0 ? (NSInteger)lround((row.maximum - row.minimum) / row.step) : 0;
_detents = count > 0 && count <= 24;
_title.font = SGTitleFont();
@@ -498,6 +500,35 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
@end
+#pragma mark - rows waiting on a switch
+
+// What a disabled control fades to, about the strength of the system's tertiary label.
+static const CGFloat kWaitingAlpha = 0.4;
+
+static NSArray<UIView *> *controlsIn(UITableViewCell *cell) {
+ NSMutableArray<UIView *> *views = [NSMutableArray arrayWithArray:cell.contentView.subviews];
+ if (cell.accessoryView) {
+ [views addObject:cell.accessoryView];
+ [views addObjectsFromArray:cell.accessoryView.subviews];
+ }
+ return [views filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIView *view, NSDictionary *bindings) {
+ return [view isKindOfClass:UIControl.class];
+ }]];
+}
+
+// A row waiting on a switch reads dimmed, the way a control that is off does, and its own switch, slider or
+// button takes no touch, so a tap lands on the row and nudges the switch it waits on instead (-nudgeAt:).
+static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTitle) {
+ cell.contentView.alpha = waiting ? kWaitingAlpha : 1;
+ cell.accessoryView.alpha = waiting ? kWaitingAlpha : 1;
+ cell.accessibilityHint = waiting ? [NSString stringWithFormat:@"Turn on %@ first.", switchTitle] : nil;
+ if (!waiting) return;
+ for (UIControl *control in controlsIn(cell)) {
+ control.enabled = NO;
+ control.userInteractionEnabled = NO;
+ }
+}
+
#pragma mark - the page
@implementation SGModPage {
@@ -507,6 +538,7 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
UIView *_footer;
NSTimer *_ticker;
BOOL _live;
+ NSIndexPath *_nudgeAfterScroll; // the switch a waiting row's tap is scrolling to
}
- (instancetype)initWithTitle:(NSString *)title intro:(NSString *)intro sections:(NSArray<SGModSection *> *)sections footer:(NSString *)footer {
@@ -570,6 +602,77 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
[self showRowsThen:nil];
}
+// The switch row a row waits on, among this page's rows.
+- (SGModRow *)switchFor:(SGModRow *)row {
+ if (!row.waitsOn) return nil;
+ for (SGModSection *s in _sections) for (SGModRow *other in s.rows) {
+ if (other != row && [other.key isEqualToString:row.waitsOn]) return other;
+ }
+ return nil;
+}
+
+- (BOOL)isWaiting:(SGModRow *)row {
+ return row.waitsOn && !SGFlag(row.waitsOn, [self switchFor:row].defaultOn);
+}
+
+- (NSIndexPath *)pathOfRow:(SGModRow *)row {
+ for (NSUInteger section = 0; section < _shown.count; section++) {
+ NSUInteger index = [_shown[section] indexOfObjectIdenticalTo:row];
+ if (index != NSNotFound) return [NSIndexPath indexPathForRow:(NSInteger)index inSection:(NSInteger)section];
+ }
+ return nil;
+}
+
+// A tap on a row waiting on a switch: the switch is brought into view if it is not, then nudged.
+- (void)nudgeSwitchFor:(SGModRow *)row {
+ NSIndexPath *path = [self pathOfRow:[self switchFor:row]];
+ if (!path) return;
+ UITableView *table = self.tableView;
+ CGRect shown = UIEdgeInsetsInsetRect(table.bounds, table.adjustedContentInset);
+ if (CGRectContainsRect(shown, [table rectForRowAtIndexPath:path])) {
+ [self nudgeAt:path];
+ return;
+ }
+ _nudgeAfterScroll = path;
+ [table scrollToRowAtIndexPath:path atScrollPosition:UITableViewScrollPositionNone animated:YES];
+}
+
+- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
+ NSIndexPath *path = _nudgeAfterScroll;
+ _nudgeAfterScroll = nil;
+ if (path) [self nudgeAt:path];
+}
+
+// The switch leans 6pt towards on and springs back, with a light tap, so the eye and the finger find what to
+// turn on first. Each nudge starts from wherever the last one has the switch, so taps in a row never jump it.
+// With Reduce Motion nothing moves: the switch's row lights up for a moment instead.
+- (void)nudgeAt:(NSIndexPath *)path {
+ UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path];
+ UIView *toggle = controlsIn(cell).lastObject;
+ if (!toggle) return;
+ [[[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight] impactOccurred];
+ UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, toggle);
+ if (UIAccessibilityIsReduceMotionEnabled()) {
+ UIColor *card = cell.backgroundColor;
+ cell.backgroundColor = UIColor.systemGray4Color;
+ [UIView animateWithDuration:0.4 delay:0.1 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{
+ cell.backgroundColor = card;
+ } completion:nil];
+ return;
+ }
+ BOOL rtl = [UIView userInterfaceLayoutDirectionForSemanticContentAttribute:toggle.semanticContentAttribute] == UIUserInterfaceLayoutDirectionRightToLeft;
+ UIViewPropertyAnimator *lean = [[UIViewPropertyAnimator alloc] initWithDuration:0.12 controlPoint1:CGPointMake(0.23, 1) controlPoint2:CGPointMake(0.32, 1) animations:^{
+ toggle.transform = CGAffineTransformMakeTranslation(rtl ? -6 : 6, 0);
+ }];
+ [lean addCompletion:^(UIViewAnimatingPosition position) {
+ UIViewPropertyAnimator *back = [[UIViewPropertyAnimator alloc] initWithDuration:0.4 dampingRatio:0.35 animations:^{
+ toggle.transform = CGAffineTransformIdentity;
+ }];
+ [back startAnimation];
+ }];
+ [lean startAnimation];
+}
+
// The row a switch or an ⓘ belongs to, by the cell it sits in: rows coming and going move the rows under
// them, so a position remembered when the cell was made may be stale.
- (NSIndexPath *)pathOf:(UIView *)control {
@@ -682,6 +785,7 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
SGModSliderCell *cell = [table dequeueReusableCellWithIdentifier:@"slider"] ?: [[SGModSliderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"slider"];
cell.backgroundColor = SGCardBackground();
[cell showRow:row];
+ showWaiting(cell, [self isWaiting:row], [self switchFor:row].title);
return cell;
}
UITableViewCell *cell = SGDequeueCell(table, @"row");
@@ -730,11 +834,19 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
} else if (row.action) {
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
}
+ BOOL waiting = [self isWaiting:row];
+ showWaiting(cell, waiting, [self switchFor:row].title);
+ if (waiting) cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)tableView:(UITableView *)table didSelectRowAtIndexPath:(NSIndexPath *)path {
SGModRow *row = [self rowAt:path];
+ if ([self isWaiting:row]) {
+ [table deselectRowAtIndexPath:path animated:NO];
+ [self nudgeSwitchFor:row];
+ return;
+ }
if (flagRowLocked(row)) {
[table deselectRowAtIndexPath:path animated:YES];
[self explainLock];
@@ -822,6 +934,12 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(wait * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.tableView reloadData]; });
};
BOOL moved = [self showRowsThen:row.changed ? reload : nil];
+ // The rows waiting on this switch stay where they are and fade to their new state.
+ NSMutableArray<NSIndexPath *> *waiting = [NSMutableArray array];
+ for (NSIndexPath *visible in self.tableView.indexPathsForVisibleRows) {
+ if ([[self rowAt:visible].waitsOn isEqualToString:row.key]) [waiting addObject:visible];
+ }
+ if (waiting.count) [self.tableView reloadRowsAtIndexPaths:waiting withRowAnimation:UITableViewRowAnimationFade];
if (row.changed && !moved) reload();
if (on && row.warning) [self warn:row];
}
diff --git a/tweak/Sources/Shared/Haptics/HapticsSettings.m b/tweak/Sources/Shared/Haptics/HapticsSettings.m
index f0909dce..f998cb39 100644
--- a/tweak/Sources/Shared/Haptics/HapticsSettings.m
+++ b/tweak/Sources/Shared/Haptics/HapticsSettings.m
@@ -92,7 +92,7 @@ NSArray<SGModSection *> *SGVibrationsSections(void) {
// Felt as it is set: a tap at the new strength with each step.
SGPlayFeedback(SGFeedbackAdd);
});
- controlStrength.visible = ^BOOL { return SGEnabled(SGKeyControlHaptics); };
+ controlStrength.waitsOn = SGKeyControlHaptics;
// The list reads the stored index, so someone with none stored gets the one picked for them.
if (SGInt(SGKeyMusicHapticsMode, -1) < 0) SGSetInt(SGKeyMusicHapticsMode, SGMusicHapticsModeNow());
diff --git a/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m b/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
index 3f4bd4b8..90dc8417 100644
--- a/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
+++ b/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
@@ -73,7 +73,6 @@ static void forget(void (^done)(void)) {
UIViewController *SGHeadGesturesSettingsPage(void) {
SGModRow *toggle = SGOptionRow(@"AirPods gestures", @"Nod twice to like the song, shake your head to skip it", SGKeyHeadGestures);
toggle.changed = ^(BOOL on) { SGHeadGesturesSettingsChanged(); };
- BOOL (^on)(void) = ^BOOL { return SGFlag(SGKeyHeadGestures, NO); };
SGModRow *sensitivity = SGSliderRow(@"Sensitivity", @"Higher counts a smaller move",
SGHeadSensitivityMin, SGHeadSensitivityMax, SGHeadSensitivityStep,
@@ -83,17 +82,17 @@ UIViewController *SGHeadGesturesSettingsPage(void) {
SGHeadGesturesSettingsChanged();
},
^NSString *(double value) { return [NSString stringWithFormat:@"%ld%%", lround(value)]; });
- sensitivity.visible = on;
+ sensitivity.waitsOn = SGKeyHeadGestures;
// Learning and forgetting change what Forget's row reads, which no switch on the page tells it.
__block __weak SGModPage *page;
void (^refresh)(void) = ^{ [page refreshVisibility]; };
SGModRow *nod = SGStatActionRow(@"Learn your nod", nil, ^NSString *{ return learnedValue(SGKeyHeadNod); }, ^{ learn(SGHeadAxisPitch, refresh); });
SGModRow *shake = SGStatActionRow(@"Learn your shake", nil, ^NSString *{ return learnedValue(SGKeyHeadShake); }, ^{ learn(SGHeadAxisYaw, refresh); });
- nod.visible = shake.visible = on;
SGModRow *forgetRow = SGActionRow(@"Forget what it learned", nil, ^{ forget(refresh); });
forgetRow.color = SGRed();
- forgetRow.visible = ^BOOL { return on() && anythingLearned(); };
+ forgetRow.visible = ^BOOL { return anythingLearned(); };
+ nod.waitsOn = shake.waitsOn = forgetRow.waitsOn = SGKeyHeadGestures;
SGModPage *shown = [[SGModPage alloc] initWithTitle:@"AirPods gestures" intro:nil sections:@[
SGSection(nil, @[SGWithSymbol(toggle, @"airpods.pro"), sensitivity]),