Merge pull request #186 from Ebullioscopic/feature/lock-screen

Add Parallax Effect Media Player
This commit is contained in:
Hariharan Mudaliar 2025-12-20 21:11:34 +05:30 • committed by GitHub
commit aedcf9e050
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 2 deletions

View file

@ -3283,6 +3283,9 @@
}
}
}
},
"Applies the notch-style parallax effect to the lock screen media widget album art." : {
},
"Are you sure you want to delete \"%@\"?" : {
"comment" : "A confirmation prompt asking the user to confirm the deletion of a custom idle animation. The placeholder text inside the quotation marks should be replaced with the name of the animation.",
@ -10999,6 +11002,9 @@
"Lock Screen Liquid Glass" : {
"comment" : "The title of the music panel on the lock screen.",
"isCommentAutoGenerated" : true
},
"Lock Screen Media" : {
},
"Lock screen panel preview" : {
"comment" : "A description of the content displayed in the lock screen panel.",

View file

@ -38,6 +38,7 @@ struct LockScreenMusicPanel: View {
@Default(.musicControlSlots) private var slotConfig
@Default(.musicSkipBehavior) private var musicSkipBehavior
@Default(.enableLyrics) private var enableLyrics
@Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenParallaxEnabled
init(animator: LockScreenPanelAnimator) {
_animator = ObservedObject(wrappedValue: animator)
@ -238,6 +239,7 @@ struct LockScreenMusicPanel: View {
}
}
.albumArtFlip(angle: musicManager.flipAngle)
.modifier(ParallaxMotionModifier(magnitude: 12, enableOverride: lockScreenParallaxEnabled))
.frame(width: size, height: size)
.background(albumArtBackground(cornerRadius: cornerRadius))
}

View file

@ -1849,6 +1849,7 @@ struct Media: View {
@Default(.enableLockScreenMediaWidget) private var enableLockScreenMediaWidget
@Default(.showSneakPeekOnTrackChange) private var showSneakPeekOnTrackChange
@Default(.lockScreenGlassStyle) private var lockScreenGlassStyle
@Default(.lockScreenMusicAlbumParallaxEnabled) private var lockScreenMusicAlbumParallaxEnabled
private func highlightID(_ title: String) -> String {
SettingsTab.media.highlightID(for: title)
@ -1905,6 +1906,14 @@ struct Media: View {
} header: {
Text("Media controls")
}
Section(header: Text("Lock Screen Media")) {
Defaults.Toggle("Enable album art parallax", key: .lockScreenMusicAlbumParallaxEnabled)
.settingsHighlight(id: highlightID("Enable album art parallax"))
Text("Applies the notch-style parallax effect to the lock screen media widget album art.")
.font(.caption)
.foregroundStyle(.secondary)
}
if musicControlWindowEnabled {
Section {
Picker("Skip buttons", selection: $musicSkipBehavior) {

View file

@ -11,13 +11,14 @@ import Defaults
struct ParallaxMotionModifier: ViewModifier {
var magnitude: Double
var enableOverride: Bool?
@Default(.enableParallaxEffect) var enableParallaxEffect
@State private var offset: CGSize = .zero
@State private var isHovering = false
func body(content: Content) -> some View {
if !enableParallaxEffect {
if !(enableOverride ?? enableParallaxEffect) {
content
} else {
content
@ -65,6 +66,6 @@ struct ParallaxMotionModifier: ViewModifier {
extension View {
func parallax3D(magnitude: Double = 10) -> some View {
modifier(ParallaxMotionModifier(magnitude: magnitude))
modifier(ParallaxMotionModifier(magnitude: magnitude, enableOverride: nil))
}
}

View file

@ -474,6 +474,7 @@ extension Defaults.Keys {
static let lockScreenWeatherProviderSource = Key<LockScreenWeatherProviderSource>("lockScreenWeatherProviderSource", default: .openMeteo)
static let lockScreenWeatherVerticalOffset = Key<Double>("lockScreenWeatherVerticalOffset", default: 0)
static let lockScreenMusicVerticalOffset = Key<Double>("lockScreenMusicVerticalOffset", default: 0)
static let lockScreenMusicAlbumParallaxEnabled = Key<Bool>("lockScreenMusicAlbumParallaxEnabled", default: true)
static let lockScreenTimerVerticalOffset = Key<Double>("lockScreenTimerVerticalOffset", default: 0)
static let lockScreenGlassStyle = Key<LockScreenGlassStyle>("lockScreenGlassStyle", default: .liquid)
static let lockScreenShowAppIcon = Key<Bool>("lockScreenShowAppIcon", default: false)