Update Remappable behaviour enhancement

This commit is contained in:
Hariharan Mudaliar 2025-12-14 12:38:34 +05:30
commit e5433c28d5
No known key found for this signature in database
GPG key ID: D04F1C2B9194DDFC
5 changed files with 35 additions and 29 deletions

View file

@ -2838,10 +2838,6 @@
}
}
},
"Allow media output control in layouts" : {
"comment" : "A toggle that enables media output control in layouts.",
"isCommentAutoGenerated" : true
},
"ALPHA" : {
"comment" : "A label indicating a feature that is still in development.",
"isCommentAutoGenerated" : true
@ -8878,6 +8874,10 @@
},
"Fit to Notch" : {
},
"Floating window panel skip behaviour" : {
"comment" : "A section header that describes the floating window panel's skip behaviour settings.",
"isCommentAutoGenerated" : true
},
"Focus active: %@" : {
"comment" : "An accessibility label for the focus widget, describing the currently active focus mode.",
@ -17497,6 +17497,10 @@
}
}
},
"Show sneak peek on playback changes" : {
"comment" : "A toggle that enables showing sneak peek when the currently playing track changes.",
"isCommentAutoGenerated" : true
},
"Show the active Focus name inside the indicator." : {
"comment" : "A description of why the \"Show Focus Label\" toggle is disabled when the \"Show Focus as brief toast\" toggle is enabled.",
"isCommentAutoGenerated" : true
@ -17530,10 +17534,6 @@
}
}
},
"Skip behaviour" : {
"comment" : "A section header that describes the skip behaviour settings.",
"isCommentAutoGenerated" : true
},
"Skip buttons" : {
"comment" : "A section header that lists the skip behaviour options.",
"isCommentAutoGenerated" : true

View file

@ -163,6 +163,8 @@ struct MusicSlotConfigurationView: View {
.font(.caption2)
.foregroundStyle(.secondary)
.frame(width: 72)
.lineLimit(1)
.minimumScaleFactor(0.8)
.multilineTextAlignment(.center)
}
.opacity(control == .mediaOutput && !showMediaOutputControl ? 0.4 : 1)

View file

@ -1363,6 +1363,7 @@ struct Media: View {
@Default(.musicSkipBehavior) private var musicSkipBehavior
@Default(.musicControlWindowEnabled) private var musicControlWindowEnabled
@Default(.enableLockScreenMediaWidget) private var enableLockScreenMediaWidget
@Default(.showSneakPeekOnTrackChange) private var showSneakPeekOnTrackChange
private func highlightID(_ title: String) -> String {
SettingsTab.media.highlightID(for: title)
@ -1408,10 +1409,6 @@ struct Media: View {
customBadge(text: "Beta")
}
}
Defaults.Toggle(key: .showMediaOutputControl) {
Text("Allow media output control in layouts")
}
.disabled(!showShuffleAndRepeat)
if showShuffleAndRepeat {
MusicSlotConfigurationView()
} else {
@ -1423,20 +1420,22 @@ struct Media: View {
} header: {
Text("Media controls")
}
Section {
Picker("Skip buttons", selection: $musicSkipBehavior) {
ForEach(MusicSkipBehavior.allCases) { behavior in
Text(behavior.displayName).tag(behavior)
if musicControlWindowEnabled {
Section {
Picker("Skip buttons", selection: $musicSkipBehavior) {
ForEach(MusicSkipBehavior.allCases) { behavior in
Text(behavior.displayName).tag(behavior)
}
}
}
.pickerStyle(.segmented)
.settingsHighlight(id: highlightID("Skip buttons"))
.pickerStyle(.segmented)
.settingsHighlight(id: highlightID("Skip buttons"))
Text(musicSkipBehavior.description)
.font(.caption)
.foregroundStyle(.secondary)
} header: {
Text("Skip behaviour")
Text(musicSkipBehavior.description)
.font(.caption)
.foregroundStyle(.secondary)
} header: {
Text("Floating window panel skip behaviour")
}
}
Section {
Toggle(
@ -1450,6 +1449,8 @@ struct Media: View {
.disabled(!coordinator.musicLiveActivityEnabled)
.help("Displays play/pause and skip buttons beside the notch while music is active. Disabled by default.")
Toggle("Enable sneak peek", isOn: $enableSneakPeek)
Toggle("Show sneak peek on playback changes", isOn: $showSneakPeekOnTrackChange)
.disabled(!enableSneakPeek)
Defaults.Toggle("Enable lyrics", key: .enableLyrics)
.settingsHighlight(id: highlightID("Enable lyrics"))
Picker("Sneak Peek Style", selection: $sneakPeekStyles){

View file

@ -220,14 +220,14 @@ class MusicManager: ObservableObject {
if eventIsPlaying != self.isPlaying {
let animation: Animation? = (expectedState == eventIsPlaying) ? .smooth(duration: 0.18) : .smooth
applyPlayState(eventIsPlaying, animation: animation)
if eventIsPlaying && !state.title.isEmpty && !state.artist.isEmpty {
self.updateSneakPeek()
}
} else {
self.updateIdleState(state: eventIsPlaying)
}
if eventIsPlaying && !state.title.isEmpty && !state.artist.isEmpty {
self.updateSneakPeek()
}
// Check for changes in track metadata using last artwork change values
let titleChanged = state.title != self.lastArtworkTitle
let artistChanged = state.artist != self.lastArtworkArtist
@ -239,6 +239,8 @@ class MusicManager: ObservableObject {
let hasContentChange = titleChanged || artistChanged || albumChanged || artworkChanged || bundleChanged
// Handle artwork and visual transitions for changed content
let shouldAutoPeekOnTrackChange = Defaults[.showSneakPeekOnTrackChange]
if hasContentChange {
self.triggerFlipAnimation()
@ -263,7 +265,7 @@ class MusicManager: ObservableObject {
self.fetchLyrics()
// Only update sneak peek if there's actual content and something changed
if !state.title.isEmpty && !state.artist.isEmpty && state.isPlaying {
if shouldAutoPeekOnTrackChange && !state.title.isEmpty && !state.artist.isEmpty && state.isPlaying {
self.updateSneakPeek()
}
}

View file

@ -440,6 +440,7 @@ extension Defaults.Keys {
static let coloredSpectrogram = Key<Bool>("coloredSpectrogram", default: true)
static let enableSneakPeek = Key<Bool>("enableSneakPeek", default: false)
static let sneakPeekStyles = Key<SneakPeekStyle>("sneakPeekStyles", default: .standard)
static let showSneakPeekOnTrackChange = Key<Bool>("showSneakPeekOnTrackChange", default: true)
static let enableFullscreenMediaDetection = Key<Bool>("enableFullscreenMediaDetection", default: true)
static let waitInterval = Key<Double>("waitInterval", default: 3)
static let showShuffleAndRepeat = Key<Bool>("showShuffleAndRepeat", default: true)