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: AirPods gestures get a Chime on activation switch and Apple's names

My-Name-Is-Jeff3f9d5b55840a
diff --git a/docs/tweaks.md b/docs/tweaks.md
index 825ad030..4e51112f 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -347,7 +347,8 @@ Shared:
says: Nothing, back or forward 15 s, play or pause (which listens with the song paused too), next or
previous track, shuffle, repeat, or Like, which adds the track to Liked Songs through Spotify's
collection platform (addURL:showUIConfirmation:completion:); Like and Next track until changed. A
- tone played through Spotify's playback session confirms each, whatever the Ring/Silent switch says.
+ tone played through Spotify's playback session confirms each, whatever the Ring/Silent switch says,
+ unless Chime on activation is off (spotifyglass.headgestures.chime; Try it and teaching always sound).
Try it listens a few seconds and names in its row what it picked up, doing nothing to the song. A
sheet teaches one's own nod and shake, five of each after a tone, a ring showing the head live (a dot
that moves with it, ticks lighting toward where it went; SGHeadMotionListen) and five dots counting
diff --git a/tweak/Sources/Shared/HeadGestures/HeadGestures.h b/tweak/Sources/Shared/HeadGestures/HeadGestures.h
index 1e5d8a2d..77e42b23 100644
--- a/tweak/Sources/Shared/HeadGestures/HeadGestures.h
+++ b/tweak/Sources/Shared/HeadGestures/HeadGestures.h
@@ -27,6 +27,8 @@
// Each gesture's SGHeadAction; unset is Like for the nod and Next track for the shake.
#define SGKeyHeadNodAction @"spotifyglass.headgestures.nodaction"
#define SGKeyHeadShakeAction @"spotifyglass.headgestures.shakeaction"
+// Whether a gesture that fires a command plays its tone; on until switched off. Try it and teaching always do.
+#define SGKeyHeadChime @"spotifyglass.headgestures.chime"
enum { SGHeadSensitivityMin = 50, SGHeadSensitivityMax = 200, SGHeadSensitivityStep = 10 };
diff --git a/tweak/Sources/Shared/HeadGestures/HeadGestures.x b/tweak/Sources/Shared/HeadGestures/HeadGestures.x
index 8bd7ce95..9e083359 100644
--- a/tweak/Sources/Shared/HeadGestures/HeadGestures.x
+++ b/tweak/Sources/Shared/HeadGestures/HeadGestures.x
@@ -289,7 +289,8 @@ static void sample(CMDeviceMotion *motion) {
if (sg_recording || sg_held || !SGFlag(SGKeyHeadGestures, NO)) return;
SGHeadAction action = SGHeadGestureAction(gesture);
if (action == SGHeadActionNothing) return;
- SGHeadGesturesCue(perform(action) ? SGHeadCueWorked : SGHeadCueFailed);
+ BOOL worked = perform(action);
+ if (SGFlag(SGKeyHeadChime, YES)) SGHeadGesturesCue(worked ? SGHeadCueWorked : SGHeadCueFailed);
});
}
diff --git a/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m b/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
index 58c61c0e..892d3bcc 100644
--- a/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
+++ b/tweak/Sources/Shared/HeadGestures/HeadGesturesSettings.m
@@ -56,11 +56,12 @@ static SGModRow *actionRow(NSString *title, SGHeadGesture gesture) {
}
UIViewController *SGHeadGesturesSettingsPage(void) {
- SGModRow *toggle = SGOptionRow(@"AirPods gestures", @"Nod twice or shake your head to control the music", SGKeyHeadGestures);
+ SGModRow *toggle = SGOptionRow(@"Head gestures", @"Nod twice or shake your head to control the music", SGKeyHeadGestures);
toggle.changed = ^(BOOL on) { SGHeadGesturesSettingsChanged(); };
- SGModRow *nodAction = SGWithSymbol(actionRow(@"Double nod", SGHeadGestureDoubleNod), @"arrow.up.and.down");
- SGModRow *shakeAction = SGWithSymbol(actionRow(@"Shake", SGHeadGestureShake), @"arrow.left.and.right");
+ SGModRow *nodAction = SGWithSymbol(actionRow(@"Nod twice", SGHeadGestureDoubleNod), @"arrow.up.and.down");
+ SGModRow *shakeAction = SGWithSymbol(actionRow(@"Shake your head", SGHeadGestureShake), @"arrow.left.and.right");
+ SGModRow *chime = SGWithSymbol(SGSwitchRow(@"Chime on activation", nil, SGKeyHeadChime), @"bell");
__block __weak SGModPage *page;
SGModRow *teach = SGStatActionRow(@"Teach your gestures", @"Five of each, one after each tone", ^NSString *{ return learnedValue(); }, ^{
@@ -88,7 +89,7 @@ UIViewController *SGHeadGesturesSettingsPage(void) {
SGHeadGesturesCue(SGHeadCueReady);
SGHeadGesturesTry(kTrySeconds, ^(SGHeadGesture gesture, BOOL heard) {
trying = NO;
- tried = gesture == SGHeadGestureDoubleNod ? @"Double nod" : gesture == SGHeadGestureShake ? @"Shake" : heard ? @"Nothing" : @"No motion";
+ tried = gesture == SGHeadGestureDoubleNod ? @"Nod twice" : gesture == SGHeadGestureShake ? @"Head shake" : heard ? @"Nothing" : @"No motion";
SGHeadGesturesCue(gesture != SGHeadGestureNone ? SGHeadCueWorked : SGHeadCueFailed);
NSString *spoken = gesture != SGHeadGestureNone ? [@"Picked up: " stringByAppendingString:tried]
: heard ? @"Picked up nothing. Try a bigger move, or raise Sensitivity."
@@ -101,14 +102,15 @@ UIViewController *SGHeadGesturesSettingsPage(void) {
SGModRow *forgetRow = SGActionRow(@"Forget what it learned", nil, ^{ forget(^{ [page refreshVisibility]; }); });
forgetRow.color = SGRed();
forgetRow.visible = ^BOOL { return anythingLearned(); };
- for (SGModRow *row in @[nodAction, shakeAction, teach, sensitivity, tryRow, forgetRow]) row.waitsOn = SGKeyHeadGestures;
+ for (SGModRow *row in @[nodAction, shakeAction, chime, teach, sensitivity, tryRow, forgetRow]) row.waitsOn = SGKeyHeadGestures;
SGModPage *shown = [[SGModPage alloc] initWithTitle:@"AirPods gestures" intro:nil sections:@[
SGSection(nil, @[SGWithSymbol(toggle, @"airpods.pro")]),
- SGNotedSection(@"Gestures", @[nodAction, shakeAction],
- @"They work while Spotify plays through headphones that track head motion: AirPods Pro, AirPods 3 or later, "
- "AirPods Max and some Beats. Set to Play or pause, they listen with a song paused too. A tone in the music "
- "confirms each, a rising pair when it worked and a low one when it did not, with the iPhone on silent too."),
+ SGNotedSection(@"Gestures", @[nodAction, shakeAction, chime],
+ @"They work while Spotify plays through headphones that track head motion: AirPods Pro, AirPods (3rd "
+ "generation and later), AirPods Max and some Beats. Set to Play or pause, they listen with a song paused too. With the chime on, a "
+ "tone in the music confirms each, a rising pair when it worked and a low one when it did not, with the "
+ "iPhone on silent too. iOS asks once for Motion & Fitness access, which is how Spotify reads the movement."),
SGNotedSection(@"Fit to you", @[teach, sensitivity, tryRow, forgetRow],
@"Teaching sets how big a move counts from five of your own. Sensitivity scales that for both. Try it does "
"nothing to the music, so you can tune it while a song plays."),
diff --git a/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m b/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m
index 0e482633..593d6bfb 100644
--- a/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m
+++ b/tweak/Sources/Shared/HeadGestures/HeadGesturesTeach.m
@@ -406,7 +406,7 @@ static BOOL headOffset(double *pitch, double *yaw) {
#pragma mark - what it shows
- (void)showGesture {
- _heading.text = self.nod ? @"Double nod" : @"Shake";
+ _heading.text = self.nod ? @"Nod twice" : @"Shake your head";
_dial.accessibilityLabel = self.nod ? @"Double nods" : @"Shakes";
[self showCount];
}