fixed spacing on minimalist music view and spacing between tabs

This commit is contained in:
Venkatesh 2026-04-03 16:55:13 +08:00
commit 82dc4ce342
23 changed files with 69639 additions and 60861 deletions

View file

@ -612,7 +612,7 @@ struct NotchHomeView: View {
.combined(with: .blurReplace.animation(.smooth.speed(0.9)))
.combined(with: .move(edge: .top)))
.blur(radius: vm.notchState == .closed ? 30 : 0)
.padding(8) //Put the main padding here for consistency!!!
.padding(Defaults[.enableMinimalisticUI] ? 0 : 8) //Putting the main padding for home view here for consistency
}
private var minimalisticOverridePayload: ExtensionNotchExperiencePayload? {

View file

@ -793,7 +793,8 @@ struct SettingsView: View {
SettingsSearchEntry(tab: .shelf, title: "Expanded drag detection area", keywords: ["shelf", "drag"], highlightID: SettingsTab.shelf.highlightID(for: "Expanded drag detection area")),
SettingsSearchEntry(tab: .shelf, title: "Copy items on drag", keywords: ["shelf", "drag", "copy"], highlightID: SettingsTab.shelf.highlightID(for: "Copy items on drag")),
SettingsSearchEntry(tab: .shelf, title: "Remove from shelf after dragging", keywords: ["shelf", "drag", "remove"], highlightID: SettingsTab.shelf.highlightID(for: "Remove from shelf after dragging")),
SettingsSearchEntry(tab: .shelf, title: "Quick Share Service", keywords: ["shelf", "share", "airdrop"], highlightID: SettingsTab.shelf.highlightID(for: "Quick Share Service")),
SettingsSearchEntry(tab: .shelf, title: "Quick Share Service", keywords: ["shelf", "share", "airdrop", "localsend"], highlightID: SettingsTab.shelf.highlightID(for: "Quick Share Service")),
SettingsSearchEntry(tab: .shelf, title: "LocalSend Device Picker Style", keywords: ["localsend", "glass", "picker", "material"], highlightID: SettingsTab.shelf.highlightID(for: "Device Picker Style")),
// Appearance
SettingsSearchEntry(tab: .appearance, title: "Main screen style", keywords: ["dynamic island", "pill", "non-notch", "display style", "notch style"], highlightID: SettingsTab.appearance.highlightID(for: "Main screen style")),
@ -1609,7 +1610,7 @@ private struct HUDAndOSDSettingsView: View {
VStack(spacing: 20) {
HStack(spacing: 16) {
HUDSelectionCard(
title: "Dynamic Island",
title: String(localized: "Dynamic Island"),
isSelected: selectedTab == .hud,
action: {
selectedTab = .hud
@ -1649,7 +1650,7 @@ private struct HUDAndOSDSettingsView: View {
}
HUDSelectionCard(
title: "Custom OSD",
title: String(localized: "Custom OSD"),
isSelected: selectedTab == .osd,
action: {
selectedTab = .osd
@ -1691,7 +1692,7 @@ private struct HUDAndOSDSettingsView: View {
}
HUDSelectionCard(
title: "Vertical Bar",
title: String(localized: "Vertical Bar"),
isSelected: selectedTab == .vertical,
action: {
selectedTab = .vertical
@ -1734,7 +1735,7 @@ private struct HUDAndOSDSettingsView: View {
}
HUDSelectionCard(
title: "Circular",
title: String(localized: "Circular"),
isSelected: selectedTab == .circular,
action: {
selectedTab = .circular
@ -2530,9 +2531,11 @@ struct Media: View {
}
}
if showShuffleAndRepeat {
Defaults.Toggle("Show \"Change Media Output\" control", key: .showMediaOutputControl)
.settingsHighlight(id: highlightID("Show Change Media Output control"))
.help("Adds the AirPlay/route picker button back to the customizable controls palette.")
Defaults.Toggle(key: .showMediaOutputControl) {
Text("Show \"Change Media Output\" control")
}
.settingsHighlight(id: highlightID("Show Change Media Output control"))
.help("Adds the AirPlay/route picker button back to the customizable controls palette.")
MusicSlotConfigurationView()
} else {
Text("Turn on customizable controls to rearrange media buttons.")
@ -2577,10 +2580,9 @@ struct Media: View {
)
.disabled(standardControlsSuppressed)
.help(standardControlsSuppressed ? "Standard notch media controls are hidden while this toggle is off." : "")
Defaults.Toggle(
"Show floating media controls",
key: .musicControlWindowEnabled
)
Defaults.Toggle(key: .musicControlWindowEnabled) {
Text("Show floating media controls")
}
.disabled(!coordinator.musicLiveActivityEnabled || standardControlsSuppressed)
.help("Displays play/pause and skip buttons beside the notch while music is active. Disabled by default.")
Toggle("Enable sneak peek", isOn: $enableSneakPeek)
@ -2633,9 +2635,11 @@ struct Media: View {
}
.disabled(!enableLockScreenMediaWidget)
if isAppleMusicActive {
Defaults.Toggle("Show merged AirPlay and output devices", key: .lockScreenMusicMergedAirPlayOutput)
.disabled(!enableLockScreenMediaWidget)
.settingsHighlight(id: highlightID("Show merged AirPlay and output devices"))
Defaults.Toggle(key: .lockScreenMusicMergedAirPlayOutput) {
Text("Show merged AirPlay and output devices")
}
.disabled(!enableLockScreenMediaWidget)
.settingsHighlight(id: highlightID("Show merged AirPlay and output devices"))
}
Defaults.Toggle(key: .lockScreenPanelShowsBorder) {
Text("Show panel border")
@ -2985,10 +2989,9 @@ struct CalendarSettings: View {
}
}
Defaults.Toggle(
"Hide active event and show next upcoming event",
key: .lockScreenShowCalendarEventAfterStartEnabled
)
Defaults.Toggle(key: .lockScreenShowCalendarEventAfterStartEnabled) {
Text("Hide active event and show next upcoming event")
}
.disabled(!lockScreenShowCalendarEvent || lockScreenShowCalendarEventEntireDuration)
.settingsHighlight(id: highlightID("Hide active event and show next upcoming event"))
@ -3087,12 +3090,12 @@ struct CalendarSettings: View {
private func statusText(for status: EKAuthorizationStatus) -> String {
switch status {
case .fullAccess, .authorized: return "Full Access"
case .writeOnly: return "Write Only"
case .denied: return "Denied"
case .restricted: return "Restricted"
case .notDetermined: return "Not Determined"
@unknown default: return "Unknown"
case .fullAccess, .authorized: return String(localized: "Full Access")
case .writeOnly: return String(localized: "Write Only")
case .denied: return String(localized: "Denied")
case .restricted: return String(localized: "Restricted")
case .notDetermined: return String(localized: "Not Determined")
@unknown default: return String(localized: "Unknown")
}
}
@ -3449,12 +3452,14 @@ struct Shelf: View {
if let imgData = provider.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.aspectRatio(contentMode: .fit)
.scaledToFit()
.frame(width: 16, height: 16)
.clipShape(RoundedRectangle(cornerRadius: 3))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 16, height: 16)
}
}
.frame(width: 16, height: 16)
.foregroundColor(.accentColor)
Text(provider.id)
}
@ -3470,12 +3475,14 @@ struct Shelf: View {
if let imgData = selectedProvider.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.aspectRatio(contentMode: .fit)
.scaledToFit()
.frame(width: 16, height: 16)
.clipShape(RoundedRectangle(cornerRadius: 3))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 16, height: 16)
}
}
.frame(width: 16, height: 16)
.foregroundColor(.accentColor)
VStack(alignment: .leading, spacing: 2) {
Text("Currently selected: \(selectedProvider.id)")
@ -3497,6 +3504,10 @@ struct Shelf: View {
.font(.caption)
.foregroundStyle(.secondary)
}
if quickShareProvider == "LocalSend" {
LocalSendSettingsSection(highlightID: highlightID)
}
}
.accentColor(.effectiveAccent)
.navigationTitle("Shelf")
@ -3507,6 +3518,41 @@ struct Shelf: View {
}
}
// MARK: - LocalSend Settings Section
private struct LocalSendSettingsSection: View {
let highlightID: (String) -> String
@Default(.localSendDevicePickerGlassMode) private var glassMode
@Default(.localSendDevicePickerLiquidGlassVariant) private var liquidGlassVariant
var body: some View {
Section {
Picker("Device Picker Style", selection: $glassMode) {
ForEach(LockScreenGlassCustomizationMode.allCases) { mode in
Text(mode.localizedName).tag(mode)
}
}
.pickerStyle(.menu)
if glassMode == .customLiquid {
Picker("Liquid Glass Variant", selection: $liquidGlassVariant) {
ForEach(LiquidGlassVariant.allCases) { variant in
Text("Variant \(variant.rawValue)").tag(variant)
}
}
.pickerStyle(.menu)
}
} header: {
Text("LocalSend Device Picker")
} footer: {
Text("Customize the appearance of the LocalSend device selection popup that appears when you drop files.")
.font(.caption)
.foregroundStyle(.secondary)
}
}
}
struct LiveActivitiesSettings: View {
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
@ObservedObject var recordingManager = ScreenRecordingManager.shared
@ -3564,12 +3610,12 @@ struct LiveActivitiesSettings: View {
Section {
if !fullDiskAccessPermission.isAuthorized {
SettingsPermissionCallout(
title: "Custom Focus metadata",
message: "Full Disk Access unlocks custom Focus icons, colors, and labels. Standard Focus detection still works without it—grant access only if you need personalized indicators.",
title: String(localized: "Custom Focus metadata"),
message: String(localized: "Full Disk Access unlocks custom Focus icons, colors, and labels. Standard Focus detection still works without it—grant access only if you need personalized indicators."),
icon: "externaldrive.fill",
iconColor: .purple,
requestButtonTitle: "Request Full Disk Access",
openSettingsButtonTitle: "Open Privacy & Security",
requestButtonTitle: String(localized: "Request Full Disk Access"),
openSettingsButtonTitle: String(localized: "Open Privacy & Security"),
requestAction: { fullDiskAccessPermission.requestAccessPrompt() },
openSettingsAction: { fullDiskAccessPermission.openSystemSettings() }
)
@ -3949,8 +3995,9 @@ struct Appearance: View {
Text("Enable colored spectrograms")
}
.settingsHighlight(id: highlightID("Enable colored spectrograms"))
Defaults
.Toggle("Player tinting", key: .playerColorTinting)
Defaults.Toggle(key: .playerColorTinting) {
Text("Enable colored spectograms")
}
Defaults.Toggle(key: .lightingEffect) {
Text("Enable blur effect behind album art")
}
@ -4414,8 +4461,8 @@ struct Appearance: View {
}
let description = enableMinimalisticUI
? "Width adjustments apply only to the standard notch layout. Disable Minimalistic UI to edit this value."
: "Recommended minimum width adjusts automatically based on the number of enabled tabs."
? String(localized: "Width adjustments apply only to the standard notch layout. Disable Minimalistic UI to edit this value.")
: String(localized: "Recommended minimum width adjusts automatically based on the number of enabled tabs.")
Text(description)
.font(.caption)
@ -4649,9 +4696,11 @@ struct LockScreenSettings: View {
.disabled(!enableLockScreenMediaWidget)
.settingsHighlight(id: highlightID("Show media app icon"))
if isAppleMusicActive {
Defaults.Toggle("Show merged AirPlay and output devices", key: .lockScreenMusicMergedAirPlayOutput)
.disabled(!enableLockScreenMediaWidget)
.settingsHighlight(id: highlightID("Show merged AirPlay and output devices"))
Defaults.Toggle(key: .lockScreenMusicMergedAirPlayOutput) {
Text("Show merged AirPlay and output devices")
}
.disabled(!enableLockScreenMediaWidget)
.settingsHighlight(id: highlightID("Show merged AirPlay and output devices"))
}
Defaults.Toggle(key: .lockScreenPanelShowsBorder) {
Text("Show panel border")
@ -5259,9 +5308,9 @@ private struct LockScreenPositioningControls: View {
HStack(alignment: .top, spacing: 24) {
offsetColumn(
title: "Weather",
title: String(localized: "Weather"),
value: weatherOffset,
resetTitle: "Reset Weather",
resetTitle: String(localized: "Reset Weather"),
resetAction: resetWeatherOffset
)
@ -5269,9 +5318,9 @@ private struct LockScreenPositioningControls: View {
.frame(height: 64)
offsetColumn(
title: "Timer",
title: String(localized: "Timer"),
value: timerOffset,
resetTitle: "Reset Timer",
resetTitle: String(localized: "Reset Timer"),
resetAction: resetTimerOffset
)
@ -5279,9 +5328,9 @@ private struct LockScreenPositioningControls: View {
.frame(height: 64)
offsetColumn(
title: "Music",
title: String(localized: "Music"),
value: musicOffset,
resetTitle: "Reset Music",
resetTitle: String(localized: "Reset Music"),
resetAction: resetMusicOffset
)
@ -5293,21 +5342,21 @@ private struct LockScreenPositioningControls: View {
VStack(alignment: .leading, spacing: 16) {
widthSlider(
title: "Media Panel Width",
title: String(localized: "Media Panel Width"),
value: musicWidthBinding,
range: musicWidthRange,
resetTitle: "Reset Media Width",
resetTitle: String(localized: "Reset Media Width"),
resetAction: resetMusicWidth,
helpText: "Shrinks the lock screen media panel while keeping the expanded view full width."
helpText: String(localized: "Shrinks the lock screen media panel while keeping the expanded view full width.")
)
widthSlider(
title: "Timer Widget Width",
title: String(localized: "Timer Widget Width"),
value: timerWidthBinding,
range: timerWidthRange,
resetTitle: "Reset Timer Width",
resetTitle: String(localized: "Reset Timer Width"),
resetAction: resetTimerWidth,
helpText: "Adjusts the lock screen timer widget width without affecting button sizing."
helpText: String(localized: "Adjusts the lock screen timer widget width without affecting button sizing.")
)
}
} header: {
@ -6147,9 +6196,9 @@ struct TimerSettings: View {
Text("Default Custom Timer")
.font(.headline)
TimerDurationStepperRow(title: "Hours", value: $customHours, range: 0...23)
TimerDurationStepperRow(title: "Minutes", value: $customMinutes, range: 0...59)
TimerDurationStepperRow(title: "Seconds", value: $customSeconds, range: 0...59)
TimerDurationStepperRow(title: String(localized: "Hours"), value: $customHours, range: 0...23)
TimerDurationStepperRow(title: String(localized: "Minutes"), value: $customMinutes, range: 0...59)
TimerDurationStepperRow(title: String(localized: "Seconds"), value: $customSeconds, range: 0...59)
HStack {
Text("Current default:")
@ -6489,9 +6538,9 @@ private struct TimerPresetEditorRow: View {
}
HStack(spacing: 16) {
TimerPresetComponentControl(title: "Hours", value: hoursBinding, range: 0...23)
TimerPresetComponentControl(title: "Minutes", value: minutesBinding, range: 0...59)
TimerPresetComponentControl(title: "Seconds", value: secondsBinding, range: 0...59)
TimerPresetComponentControl(title: String(localized: "Hours"), value: hoursBinding, range: 0...23)
TimerPresetComponentControl(title: String(localized: "Minutes"), value: minutesBinding, range: 0...59)
TimerPresetComponentControl(title: String(localized: "Seconds"), value: secondsBinding, range: 0...59)
}
ColorPicker("Accent colour", selection: colorBinding, supportsOpacity: false)

View file

@ -16,6 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import AppKit
import Defaults
import SwiftUI
import UniformTypeIdentifiers
@ -24,6 +26,10 @@ struct AirDropView: View {
@State var trigger: UUID = .init()
@State var targeting = false
@Default(.quickShareProvider) var quickShareProvider
@StateObject private var quickShareService = QuickShareService.shared
@State private var showShareSettings = false
@State private var isSwitchHover = false
var body: some View {
dropArea
@ -40,7 +46,103 @@ struct AirDropView: View {
.fill(.white.opacity(0.1))
.opacity(0.5)
.clipShape(RoundedRectangle(cornerRadius: 10))
.overlay { dropLabel }
.overlay {
ZStack {
dropLabel
// Switch button in the top-right for quick-share settings
VStack {
HStack {
Spacer()
Button {
quickShareService.ensureDiscovered()
showShareSettings.toggle()
} label: {
Image(systemName: "switch.2")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 14, height: 14)
.padding(8)
.background(
RoundedRectangle(cornerRadius: 8)
.fill(isSwitchHover ? Color(.windowBackgroundColor).opacity(0.12) : Color.clear)
)
.foregroundColor(isSwitchHover ? .accentColor : .gray)
.contentShape(Rectangle())
.onHover { over in isSwitchHover = over }
.help("Quick Share settings")
}
.buttonStyle(.plain)
.popover(isPresented: $showShareSettings) {
VStack(alignment: .leading, spacing: 8) {
Text("Quick Share")
.font(.headline)
Picker("Quick Share Service", selection: $quickShareProvider) {
ForEach(quickShareService.availableProviders, id: \.id) { provider in
HStack(spacing: 8) {
Group {
if let imgData = provider.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
.clipShape(RoundedRectangle(cornerRadius: 3))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 16, height: 16)
}
}
.foregroundColor(.accentColor)
Text(provider.id)
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
}
.tag(provider.id)
}
}
.pickerStyle(.menu)
.frame(minWidth: 260)
if let selected = quickShareService.availableProviders.first(where: { $0.id == quickShareProvider }) {
HStack(alignment: .top, spacing: 8) {
Group {
if let imgData = selected.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.clipShape(RoundedRectangle(cornerRadius: 4))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 20, height: 20)
}
}
.foregroundColor(.accentColor)
VStack(alignment: .leading, spacing: 2) {
Text("Currently: \(selected.id)")
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
.fixedSize(horizontal: true, vertical: false)
Text("Files dropped here will be shared via this service")
.font(.caption2)
.foregroundStyle(.secondary)
}
}
}
}
.padding()
}
.padding(.trailing, 8)
.padding(.top, 8)
}
Spacer()
}
}
}
.aspectRatio(1, contentMode: .fit)
.contentShape(Rectangle())
}

File diff suppressed because it is too large Load diff

View file

@ -129,6 +129,10 @@ class QuickShareService: ObservableObject {
providers.insert(ad, at: 0)
}
if !providers.contains(where: { $0.id == "LocalSend" }) {
providers.insert(QuickShareProvider(id: "LocalSend", imageData: nil, supportsRawText: true), at: min(1, providers.count))
}
// System Share Menu fallback
if !providers.contains(where: { $0.id == "System Share Menu" }) {
providers.append(QuickShareProvider(id: "System Share Menu", imageData: nil, supportsRawText: true))
@ -137,11 +141,36 @@ class QuickShareService: ObservableObject {
return (providers, services)
}.value
var providers = result.providers
if let idx = providers.firstIndex(where: { $0.id == "LocalSend" }) {
providers[idx].imageData = localSendIconData()
}
self.cachedServices = result.services
self.availableProviders = result.providers
self.availableProviders = providers
self.hasDiscovered = true
self.discoveryTask = nil
}
private func localSendIconData() -> Data? {
guard let icon = NSImage(named: NSImage.Name("LocalSend")) else {
return nil
}
let thumbSize = NSSize(width: 32, height: 32)
let thumb = NSImage(size: thumbSize)
thumb.lockFocus()
icon.draw(in: NSRect(origin: .zero, size: thumbSize),
from: NSRect(origin: .zero, size: icon.size),
operation: .copy,
fraction: 1.0)
thumb.unlockFocus()
guard let tiff = thumb.tiffRepresentation,
let bitmap = NSBitmapImageRep(data: tiff)
else { return nil }
return bitmap.representation(using: .png, properties: [:])
}
// MARK: - File Picker
@MainActor
@ -154,6 +183,9 @@ class QuickShareService: ObservableObject {
isPickerOpen = true
SharingStateManager.shared.beginInteraction()
// Improve interaction in dev/test builds where app activation can be flaky.
NSApp.activate(ignoringOtherApps: true)
let panel = NSOpenPanel()
panel.allowsMultipleSelection = true
panel.canChooseDirectories = true
@ -174,8 +206,12 @@ class QuickShareService: ObservableObject {
}
}
let response = panel.runModal()
completion(response)
if let window = view?.window {
panel.beginSheetModal(for: window, completionHandler: completion)
} else {
let response = panel.runModal()
completion(response)
}
}
// MARK: - Sharing
@ -187,6 +223,21 @@ class QuickShareService: ObservableObject {
// Start security-scoped access for all file URLs
sharingAccessingURLs = fileURLs.filter { $0.startAccessingSecurityScopedResource() }
if provider.id == "LocalSend" {
SharingStateManager.shared.beginInteraction()
defer {
SharingStateManager.shared.endInteraction()
}
do {
try await LocalSendService.shared.send(items: items)
} catch {
NSAlert.popError(error)
}
stopSharingAccessingURLs()
return
}
// Setup lifecycle delegate to keep notch open during picker/service
let delegate = SharingStateManager.shared.makeDelegate { [weak self] in
self?.lifecycleDelegate = nil
@ -210,6 +261,7 @@ class QuickShareService: ObservableObject {
}
private func stopSharingAccessingURLs() {
guard !sharingAccessingURLs.isEmpty else { return }
NSLog("Stopping sharing access to URLs")
for url in sharingAccessingURLs {
url.stopAccessingSecurityScopedResource()

View file

@ -49,19 +49,25 @@ final class ShelfStateViewModel: ObservableObject {
var merged = items
// Deduplicate by identityKey while preserving order (existing first)
var seen: Set<String> = Set(merged.map { $0.identityKey })
var addedIDs: [String] = []
for it in newItems {
let key = it.identityKey
if !seen.contains(key) {
merged.append(it)
seen.insert(key)
addedIDs.append(it.id.uuidString)
}
}
items = merged
if !addedIDs.isEmpty {
ExtensionRPCServer.shared.notifyShelfItemsChanged(itemIDs: addedIDs, action: "added")
}
}
func remove(_ item: ShelfItem) {
item.cleanupStoredData()
items.removeAll { $0.id == item.id }
ExtensionRPCServer.shared.notifyShelfItemsChanged(itemIDs: [item.id.uuidString], action: "removed")
}
func updateBookmark(for item: ShelfItem, bookmark: Data) {

View file

@ -28,29 +28,49 @@ import UniformTypeIdentifiers
struct FileShareView: View {
@EnvironmentObject private var vm: DynamicIslandViewModel
@StateObject private var quickShare = QuickShareService.shared
@StateObject private var localSend = LocalSendService.shared
@Default(.quickShareProvider) var quickShareProvider: String
@State private var showQuickSharePopover = false
@State private var isSwitchHover = false
@State private var autoCloseToken = UUID()
@State private var hostView: NSView?
@State private var interactionNonce: UUID = .init()
@State private var isProcessing = false
@State private var pendingDropProviders: [NSItemProvider]?
@State private var showLocalSendPicker = false
private var selectedProvider: QuickShareProvider {
quickShare.availableProviders.first(where: { $0.id == quickShareProvider }) ?? QuickShareProvider(id: "System Share Menu", imageData: nil, supportsRawText: true)
}
private var notchToggleProviders: [QuickShareProvider] {
quickShare.availableProviders.filter { $0.id == "AirDrop" || $0.id == "LocalSend" }
}
var body: some View {
dropArea
.background(NSViewHost(view: $hostView))
.onAppear { quickShare.ensureDiscovered() }
.onAppear {
quickShare.ensureDiscovered()
localSend.startDiscovery()
}
.onDrop(of: [.fileURL, .url, .utf8PlainText, .plainText, .data, .image], isTargeted: $vm.dropZoneTargeting) { providers in
interactionNonce = .init()
vm.dropEvent = true
Task { await handleDrop(providers) }
if selectedProvider.id == "LocalSend" {
pendingDropProviders = providers
showLocalSendPicker = true
} else {
Task { await handleDrop(providers) }
}
return true
}
.onTapGesture {
Task {
await handleClick()
guard quickShare.availableProviders.first(where: { $0.id == quickShareProvider }) != nil else { return }
// Only open picker on taps when AirDrop or LocalSend is selected
if quickShareProvider == "AirDrop" || quickShareProvider == "LocalSend" {
Task { await handleClick() }
}
}
}
@ -85,12 +105,16 @@ struct FileShareView: View {
if let imgData = selectedProvider.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.aspectRatio(contentMode: .fit)
.scaledToFit()
.frame(width: 34, height: 34)
.clipped()
} else {
Image(systemName: "square.and.arrow.up")
.resizable()
.scaledToFit()
.frame(width: 34, height: 34)
}
}
.frame(width: 34, height: 34)
.foregroundStyle(
vm.dropZoneTargeting ? Color.accentColor : Color.gray
)
@ -104,11 +128,116 @@ struct FileShareView: View {
.font(.system(.headline, design: .rounded))
.foregroundColor(.white.opacity(0.8))
.multilineTextAlignment(.center)
.lineLimit(1)
.truncationMode(.tail)
.frame(maxWidth: .infinity)
}
.padding(18)
.frame(maxWidth: .infinity)
// Switch button pinned to top-right corner
VStack {
HStack {
Spacer()
Button {
vm.setAutoCloseSuppression(true, token: autoCloseToken)
quickShare.ensureDiscovered()
showQuickSharePopover.toggle()
} label: {
Image(systemName: "switch.2")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 14, height: 14)
.padding(8)
.background(RoundedRectangle(cornerRadius: 8).fill(isSwitchHover ? Color(.windowBackgroundColor).opacity(0.12) : Color.clear))
.foregroundColor(isSwitchHover ? .accentColor : .gray)
}
.buttonStyle(PlainButtonStyle())
.onHover { hovering in
isSwitchHover = hovering
vm.setAutoCloseSuppression(hovering, token: autoCloseToken)
}
.popover(isPresented: $showQuickSharePopover, arrowEdge: .bottom) {
VStack(alignment: .leading, spacing: 8) {
Text("Quick Share")
.font(.headline)
Picker("Quick Share Service", selection: $quickShareProvider) {
ForEach(quickShare.availableProviders, id: \.id) { provider in
HStack(spacing: 8) {
Group {
if let imgData = provider.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.scaledToFit()
.frame(width: 16, height: 16)
.clipShape(RoundedRectangle(cornerRadius: 3))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 16, height: 16)
}
}
.foregroundColor(.accentColor)
Text(provider.id)
.lineLimit(1)
.truncationMode(.tail)
.layoutPriority(1)
.fixedSize(horizontal: true, vertical: false)
}
.tag(provider.id)
}
}
.pickerStyle(.menu)
.frame(minWidth: 260)
if let selected = quickShare.availableProviders.first(where: { $0.id == quickShareProvider }) {
HStack(alignment: .top, spacing: 8) {
Group {
if let imgData = selected.imageData, let nsImg = NSImage(data: imgData) {
Image(nsImage: nsImg)
.resizable()
.scaledToFit()
.frame(width: 20, height: 20)
.clipShape(RoundedRectangle(cornerRadius: 4))
} else {
Image(systemName: "square.and.arrow.up")
.frame(width: 20, height: 20)
}
}
.foregroundColor(.accentColor)
VStack(alignment: .leading, spacing: 2) {
Text("Currently: \(selected.id)")
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
.truncationMode(.tail)
.layoutPriority(1)
.fixedSize(horizontal: true, vertical: false)
Text("Files shared from the shelf will use this service")
.font(.caption2)
.foregroundStyle(.secondary)
}
}
}
}
.padding()
.onAppear { vm.setAutoCloseSuppression(true, token: autoCloseToken) }
.onDisappear {
// Delay clearing suppression slightly so the close click doesn't immediately close the notch
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
vm.setAutoCloseSuppression(false, token: autoCloseToken)
}
}
.onHover { hovering in vm.setAutoCloseSuppression(hovering, token: autoCloseToken) }
}
.padding(.trailing, 8)
.padding(.top, 8)
}
Spacer()
}
// Loading overlay
if isProcessing || quickShare.isPickerOpen {
@ -120,8 +249,63 @@ struct FileShareView: View {
.scaleEffect(0.8)
)
}
if selectedProvider.id == "LocalSend" && localSend.isSending {
VStack {
HStack {
Spacer()
ZStack {
Circle()
.stroke(Color.white.opacity(0.16), lineWidth: 3)
Circle()
.trim(from: 0, to: min(max(localSend.sendProgress, 0), 1))
.stroke(
Color.white,
style: StrokeStyle(lineWidth: 3, lineCap: .round)
)
.rotationEffect(.degrees(-90))
.animation(.easeInOut(duration: 0.2), value: localSend.sendProgress)
if localSend.sendProgress > 0.99 {
Image(systemName: "checkmark")
.font(.system(size: 9, weight: .bold))
.foregroundColor(.white)
}
}
.frame(width: 24, height: 24)
.padding(.top, 10)
.padding(.trailing, 10)
}
Spacer()
}
.transition(.opacity)
}
}
.contentShape(RoundedRectangle(cornerRadius: 12))
.onChange(of: showLocalSendPicker) { _, show in
if show {
LocalSendDevicePickerWindowManager.shared.show(
onDeviceSelected: { device in
localSend.selectedDeviceID = device.id
if let providers = pendingDropProviders {
// Close the picker first since handleDrop will use quickShare properly
showLocalSendPicker = false
Task {
await handleDrop(providers)
pendingDropProviders = nil
}
}
},
onDismiss: {
showLocalSendPicker = false
pendingDropProviders = nil
}
)
} else {
LocalSendDevicePickerWindowManager.shared.hide()
}
}
}
// MARK: - Actions

View file

@ -0,0 +1,173 @@
/*
* Atoll (DynamicIsland)
* Copyright (C) 2024-2026 Atoll Contributors
*
* 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 SwiftUI
import Defaults
struct LocalSendLiveActivity: View {
@EnvironmentObject var vm: DynamicIslandViewModel
@StateObject private var localSend = LocalSendService.shared
@State private var isHovering: Bool = false
@State private var isExpanded: Bool = false
private var tint: Color {
switch localSend.transferState {
case .completed:
return .green
case .failed, .rejected:
return .red
default:
return .accentColor
}
}
private var isActive: Bool {
localSend.isSending || localSend.transferState == .completed ||
isFailedOrRejected
}
private var isFailedOrRejected: Bool {
if case .failed = localSend.transferState { return true }
if case .rejected = localSend.transferState { return true }
return false
}
var body: some View {
HStack(spacing: 0) {
// Left side: upload icon capsule
Color.clear
.background {
if isExpanded {
HStack {
ZStack {
RoundedRectangle(cornerRadius: 6, style: .continuous)
.fill(tint.opacity(0.14))
Image(systemName: leftIcon)
.font(.system(size: 14, weight: .semibold))
.foregroundStyle(tint)
}
.frame(
width: vm.effectiveClosedNotchHeight - 12,
height: vm.effectiveClosedNotchHeight - 12
)
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)
}
}
.frame(
width: isExpanded ? max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)) : 0,
height: vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)
)
// Center: closed notch body (slightly wider during transfers)
Rectangle()
.fill(.black)
.frame(
width: vm.closedNotchSize.width
+ (isHovering ? 8 : 0)
+ (isActive ? 40 : 0)
)
// Right side: progress ring or status icon
Color.clear
.background {
if isExpanded {
HStack {
rightContent
}
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .trailing)
}
}
.frame(
width: isExpanded ? max(60, vm.effectiveClosedNotchHeight) : 0,
height: vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)
)
}
.frame(height: vm.effectiveClosedNotchHeight + (isHovering ? 8 : 0))
.onAppear {
withAnimation(.smooth(duration: 0.35)) {
isExpanded = true
}
}
.onChange(of: isActive) { _, newValue in
withAnimation(.smooth(duration: 0.35)) {
isExpanded = newValue
}
}
}
private var leftIcon: String {
// Always show document upload icon on left side
return "document.badge.arrow.up.fill"
}
@ViewBuilder
private var rightContent: some View {
switch localSend.transferState {
case .completed:
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(.green)
.font(.system(size: 16, weight: .semibold))
.padding(.trailing, 6)
case .failed:
Image(systemName: "xmark.circle.fill")
.foregroundStyle(.red)
.font(.system(size: 16, weight: .semibold))
.padding(.trailing, 6)
case .rejected:
Image(systemName: "hand.raised.fill")
.foregroundStyle(.orange)
.font(.system(size: 16, weight: .semibold))
.padding(.trailing, 6)
case .sending, .idle:
LocalSendProgressRing(progress: localSend.sendProgress)
.padding(.trailing, 6)
}
}
}
// MARK: - Progress Ring
private struct LocalSendProgressRing: View {
let progress: Double
var body: some View {
ZStack {
Circle()
.stroke(Color.white.opacity(0.2), lineWidth: 2.5)
Circle()
.trim(from: 0, to: min(max(progress, 0), 1))
.stroke(
Color.accentColor,
style: StrokeStyle(lineWidth: 2.5, lineCap: .round)
)
.rotationEffect(.degrees(-90))
.animation(.easeInOut(duration: 0.2), value: progress)
if progress > 0.99 {
Image(systemName: "checkmark")
.font(.system(size: 8, weight: .bold))
.foregroundColor(.accentColor)
}
}
.frame(width: 20, height: 20)
}
}

View file

@ -77,10 +77,10 @@ struct CPUUsageDashboard: View {
Text("Usage")
.font(.caption)
.foregroundColor(.secondary)
DetailRow(color: systemColor.opacity(0.95), label: "System", value: StatsFormatting.percentage(breakdown.system))
DetailRow(color: userColor.opacity(0.95), label: "User", value: StatsFormatting.percentage(breakdown.user))
DetailRow(color: idleColor.opacity(0.7), label: "Idle", value: StatsFormatting.percentage(breakdown.idle))
DetailRow(color: nil, label: "Active", value: StatsFormatting.percentage(breakdown.activeUsage))
DetailRow(color: systemColor.opacity(0.95), label: String(localized: "System"), value: StatsFormatting.percentage(breakdown.system))
DetailRow(color: userColor.opacity(0.95), label: String(localized: "User"), value: StatsFormatting.percentage(breakdown.user))
DetailRow(color: idleColor.opacity(0.7), label: String(localized: "Idle"), value: StatsFormatting.percentage(breakdown.idle))
DetailRow(color: nil, label: String(localized: "stats_resource_active", defaultValue: "Active"), value: StatsFormatting.percentage(breakdown.activeUsage))
}
.frame(maxWidth: .infinity, alignment: .leading)
@ -171,7 +171,7 @@ private struct CPUTemperatureGauge: View {
var body: some View {
CircularGaugeView(
title: "Temperature",
title: String(localized: "Temperature"),
value: normalizedValue,
tint: tint,
centerPrimaryText: centerPrimary,

View file

@ -133,7 +133,7 @@ private struct GPUUsageDashboard: View {
.font(.caption)
.foregroundColor(.secondary)
DetailRow(color: nil, label: String(localized: "Session Avg"), value: StatsFormatting.percentage(averageUsage))
DetailRow(color: nil, label: String("localized: Last Update"), value: formattedTimestamp(lastUpdated))
DetailRow(color: nil, label: String(localized: "Last Update"), value: formattedTimestamp(lastUpdated))
if let device = primaryDevice {
Divider().padding(.vertical, 4)
DetailRow(color: nil, label: String(localized: "Active GPU"), value: device.formattedVendorModel)

View file

@ -23,6 +23,7 @@
import AtollExtensionKit
import SwiftUI
import Defaults
import AppKit
struct TabModel: Identifiable {
let id: String
@ -45,6 +46,9 @@ struct TabModel: Identifiable {
struct TabSelectionView: View {
@ObservedObject var coordinator = DynamicIslandViewCoordinator.shared
@ObservedObject private var extensionNotchExperienceManager = ExtensionNotchExperienceManager.shared
@StateObject private var quickShareService = QuickShareService.shared
@Default(.quickShareProvider) private var quickShareProvider
@State private var showQuickSharePopover = false
@Default(.enableTimerFeature) var enableTimerFeature
@Default(.enableStatsFeature) var enableStatsFeature
@Default(.enableColorPickerFeature) var enableColorPickerFeature
@ -106,9 +110,11 @@ struct TabSelectionView: View {
}
var body: some View {
HStack(spacing: 24) {
ForEach(tabs) { tab in
ForEach(Array(tabs.enumerated()), id: \.element.id) { idx, tab in
let isSelected = isSelected(tab)
let activeAccent = tab.accentColor ?? .white
// Render the tab button
TabButton(label: tab.label, icon: tab.icon, selected: isSelected) {
if tab.view == .extensionExperience {
coordinator.selectedExtensionExperienceID = tab.experienceID
@ -117,6 +123,20 @@ struct TabSelectionView: View {
}
.frame(height: 26)
.foregroundStyle(isSelected ? activeAccent : .gray)
.background {
if isSelected {
Capsule()
.fill((tab.accentColor ?? Color(nsColor: .secondarySystemFill)).opacity(0.25))
.shadow(color: (tab.accentColor ?? .clear).opacity(0.4), radius: 8)
.matchedGeometryEffect(id: "capsule", in: animation)
} else {
Capsule()
.fill(Color.clear)
.matchedGeometryEffect(id: "capsule", in: animation)
.hidden()
}
}
}
}