mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
168 lines
7.7 KiB
Swift
168 lines
7.7 KiB
Swift
//
|
|
// Constants.swift
|
|
// DynamicIsland
|
|
//
|
|
// Created by Richard Kunkli on 2024. 10. 17..
|
|
//
|
|
|
|
import SwiftUI
|
|
import Defaults
|
|
|
|
private let availableDirectories = FileManager
|
|
.default
|
|
.urls(for: .documentDirectory, in: .userDomainMask)
|
|
let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
|
|
let bundleIdentifier = Bundle.main.bundleIdentifier!
|
|
let appVersion = "\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "") (\(Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""))"
|
|
|
|
let temporaryDirectory = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!
|
|
let spacing: CGFloat = 16
|
|
|
|
struct CustomVisualizer: Codable, Hashable, Equatable, Defaults.Serializable {
|
|
let UUID: UUID
|
|
var name: String
|
|
var url: URL
|
|
var speed: CGFloat = 1.0
|
|
}
|
|
|
|
enum CalendarSelectionState: Codable, Defaults.Serializable {
|
|
case all
|
|
case selected(Set<String>)
|
|
}
|
|
|
|
enum HideNotchOption: String, Defaults.Serializable {
|
|
case always
|
|
case nowPlayingOnly
|
|
case never
|
|
}
|
|
|
|
// Define notification names at file scope
|
|
extension Notification.Name {
|
|
static let mediaControllerChanged = Notification.Name("mediaControllerChanged")
|
|
}
|
|
|
|
// Media controller types for selection in settings
|
|
enum MediaControllerType: String, CaseIterable, Identifiable, Defaults.Serializable {
|
|
case nowPlaying = "Now Playing"
|
|
case appleMusic = "Apple Music"
|
|
case spotify = "Spotify"
|
|
case youtubeMusic = "Youtube Music"
|
|
|
|
var id: String { self.rawValue }
|
|
}
|
|
|
|
// Sneak peek styles for selection in settings
|
|
enum SneakPeekStyle: String, CaseIterable, Identifiable, Defaults.Serializable {
|
|
case standard = "Default"
|
|
case inline = "Inline"
|
|
|
|
var id: String { self.rawValue }
|
|
}
|
|
|
|
extension Defaults.Keys {
|
|
// MARK: General
|
|
static let menubarIcon = Key<Bool>("menubarIcon", default: true)
|
|
static let showOnAllDisplays = Key<Bool>("showOnAllDisplays", default: false)
|
|
static let automaticallySwitchDisplay = Key<Bool>("automaticallySwitchDisplay", default: true)
|
|
static let releaseName = Key<String>("releaseName", default: "Wolf Painting 🐺🎨")
|
|
|
|
// MARK: Behavior
|
|
static let minimumHoverDuration = Key<TimeInterval>("minimumHoverDuration", default: 0.3)
|
|
static let enableHaptics = Key<Bool>("enableHaptics", default: true)
|
|
static let openNotchOnHover = Key<Bool>("openNotchOnHover", default: true)
|
|
static let extendHoverArea = Key<Bool>("extendHoverArea", default: false)
|
|
static let notchHeightMode = Key<WindowHeightMode>(
|
|
"notchHeightMode",
|
|
default: WindowHeightMode.matchRealNotchSize
|
|
)
|
|
static let nonNotchHeightMode = Key<WindowHeightMode>(
|
|
"nonNotchHeightMode",
|
|
default: WindowHeightMode.matchMenuBar
|
|
)
|
|
static let nonNotchHeight = Key<CGFloat>("nonNotchHeight", default: 32)
|
|
static let notchHeight = Key<CGFloat>("notchHeight", default: 32)
|
|
//static let openLastTabByDefault = Key<Bool>("openLastTabByDefault", default: false)
|
|
|
|
// MARK: Appearance
|
|
static let showEmojis = Key<Bool>("showEmojis", default: false)
|
|
//static let alwaysShowTabs = Key<Bool>("alwaysShowTabs", default: true)
|
|
static let showMirror = Key<Bool>("showMirror", default: false)
|
|
static let mirrorShape = Key<MirrorShapeEnum>("mirrorShape", default: MirrorShapeEnum.rectangle)
|
|
static let settingsIconInNotch = Key<Bool>("settingsIconInNotch", default: true)
|
|
static let lightingEffect = Key<Bool>("lightingEffect", default: true)
|
|
static let accentColor = Key<Color>("accentColor", default: Color.blue)
|
|
static let enableShadow = Key<Bool>("enableShadow", default: true)
|
|
static let cornerRadiusScaling = Key<Bool>("cornerRadiusScaling", default: true)
|
|
static let useModernCloseAnimation = Key<Bool>("useModernCloseAnimation", default: true)
|
|
static let showNotHumanFace = Key<Bool>("showNotHumanFace", default: false)
|
|
static let tileShowLabels = Key<Bool>("tileShowLabels", default: false)
|
|
static let showCalendar = Key<Bool>("showCalendar", default: false)
|
|
static let sliderColor = Key<SliderColorEnum>(
|
|
"sliderUseAlbumArtColor",
|
|
default: SliderColorEnum.white
|
|
)
|
|
static let playerColorTinting = Key<Bool>("playerColorTinting", default: true)
|
|
static let useMusicVisualizer = Key<Bool>("useMusicVisualizer", default: true)
|
|
static let customVisualizers = Key<[CustomVisualizer]>("customVisualizers", default: [])
|
|
static let selectedVisualizer = Key<CustomVisualizer?>("selectedVisualizer", default: nil)
|
|
|
|
// MARK: Gestures
|
|
static let enableGestures = Key<Bool>("enableGestures", default: true)
|
|
static let closeGestureEnabled = Key<Bool>("closeGestureEnabled", default: true)
|
|
static let gestureSensitivity = Key<CGFloat>("gestureSensitivity", default: 200.0)
|
|
|
|
// MARK: Media playback
|
|
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 enableFullscreenMediaDetection = Key<Bool>("enableFullscreenMediaDetection", default: true)
|
|
static let waitInterval = Key<Double>("waitInterval", default: 3)
|
|
|
|
// MARK: Battery
|
|
static let showPowerStatusNotifications = Key<Bool>("showPowerStatusNotifications", default: true)
|
|
static let showBatteryIndicator = Key<Bool>("showBatteryIndicator", default: true)
|
|
static let showBatteryPercentage = Key<Bool>("showBatteryPercentage", default: true)
|
|
static let showPowerStatusIcons = Key<Bool>("showPowerStatusIcons", default: true)
|
|
|
|
// MARK: Downloads
|
|
static let enableDownloadListener = Key<Bool>("enableDownloadListener", default: true)
|
|
static let enableSafariDownloads = Key<Bool>("enableSafariDownloads", default: true)
|
|
static let selectedDownloadIndicatorStyle = Key<DownloadIndicatorStyle>("selectedDownloadIndicatorStyle", default: DownloadIndicatorStyle.progress)
|
|
static let selectedDownloadIconStyle = Key<DownloadIconStyle>("selectedDownloadIconStyle", default: DownloadIconStyle.onlyAppIcon)
|
|
|
|
// MARK: HUD
|
|
static let inlineHUD = Key<Bool>("inlineHUD", default: false)
|
|
static let enableGradient = Key<Bool>("enableGradient", default: false)
|
|
static let systemEventIndicatorShadow = Key<Bool>("systemEventIndicatorShadow", default: false)
|
|
static let systemEventIndicatorUseAccent = Key<Bool>("systemEventIndicatorUseAccent", default: false)
|
|
|
|
// MARK: Shelf
|
|
static let dynamicShelf = Key<Bool>("dynamicShelf", default: true)
|
|
static let openShelfByDefault = Key<Bool>("openShelfByDefault", default: true)
|
|
|
|
// MARK: Calendar
|
|
static let calendarSelectionState = Key<CalendarSelectionState>("calendarSelectionState", default: .all)
|
|
|
|
// MARK: Fullscreen Media Detection
|
|
static let alwaysHideInFullscreen = Key<Bool>("alwaysHideInFullscreen", default: false)
|
|
|
|
static let hideNotchOption = Key<HideNotchOption>("hideNotchOption", default: .nowPlayingOnly)
|
|
|
|
// MARK: Wobble Animation
|
|
static let enableWobbleAnimation = Key<Bool>("enableWobbleAnimation", default: false)
|
|
|
|
// MARK: Media Controller
|
|
static let mediaController = Key<MediaControllerType>("mediaController", default: defaultMediaController)
|
|
|
|
// MARK: Stats Feature
|
|
static let enableStatsFeature = Key<Bool>("enableStatsFeature", default: false)
|
|
|
|
// Helper to determine the default media controller based on macOS version
|
|
static var defaultMediaController: MediaControllerType {
|
|
if #available(macOS 15.4, *) {
|
|
return .appleMusic
|
|
} else {
|
|
return .nowPlaying
|
|
}
|
|
}
|
|
}
|