Atoll/DynamicIsland/models/PlaybackState.swift
Jis G Jacob 5bd84270aa Atoll: fullscreen album artwork as lockscreen wallpaper
Right-click on the album art in the lock screen music panel to set it
as the desktop wallpaper. Right-click again or click anywhere on the
background to restore the original wallpaper. Wallpaper also restores
automatically on track change or screen unlock.

Uses direct plist manipulation of the wallpaper config to avoid leaving
traces in the wallpaper picker. Album art PNG is pre-cached in the
background on track change for instant application.

Adds video artwork URL fetching from iTunes catalog for Apple Music
tracks (musicVideo entity search).

Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
2026-04-29 18:39:17 +02:00

67 lines
2.2 KiB
Swift

/*
* Atoll (DynamicIsland)
* Copyright (C) 2024-2026 Atoll Contributors
*
* Originally from boring.notch project
* Modified and adapted for Atoll (DynamicIsland)
* See NOTICE for details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import Foundation
enum RepeatMode: Int, Codable {
case off = 1
case one = 2
case all = 3
}
struct PlaybackState {
var bundleIdentifier: String
var isPlaying: Bool = false
var title: String = "I'm Handsome"
var artist: String = "Me"
var album: String = "Self Love"
var contentIdentifier: String?
var contentURL: String?
var isExplicit: Bool?
var currentTime: Double = 0
var duration: Double = 0
var playbackRate: Double = 1
var isShuffled: Bool = false
var repeatMode: RepeatMode = .off
var lastUpdated: Date = Date.distantPast
var artwork: Data?
var liveArtworkURL: URL?
}
extension PlaybackState: Equatable {
static func == (lhs: PlaybackState, rhs: PlaybackState) -> Bool {
return lhs.bundleIdentifier == rhs.bundleIdentifier
&& lhs.isPlaying == rhs.isPlaying
&& lhs.title == rhs.title
&& lhs.artist == rhs.artist
&& lhs.album == rhs.album
&& lhs.contentIdentifier == rhs.contentIdentifier
&& lhs.contentURL == rhs.contentURL
&& lhs.isExplicit == rhs.isExplicit
&& lhs.currentTime == rhs.currentTime
&& lhs.duration == rhs.duration
&& lhs.isShuffled == rhs.isShuffled
&& lhs.repeatMode == rhs.repeatMode
&& lhs.artwork == rhs.artwork
&& lhs.liveArtworkURL == rhs.liveArtworkURL
}
}