mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 23:24:32 +00:00
Update DynamicIsland Configuration
This commit is contained in:
parent
ddda04369d
commit
b900804acb
8 changed files with 333 additions and 11 deletions
50
DynamicIsland/components/Notch/DynamicIslandPillShape.swift
Normal file
50
DynamicIsland/components/Notch/DynamicIslandPillShape.swift
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
/// A pill-shaped (capsule-like) clip shape used for the Dynamic Island mode
|
||||
/// on external and non-notched displays. Uses `.continuous` rounded corners
|
||||
/// for an Apple-style squircle appearance, inspired by DynamicNotchKit's
|
||||
/// floating style.
|
||||
struct DynamicIslandPillShape: Shape {
|
||||
var cornerRadius: CGFloat
|
||||
|
||||
var animatableData: CGFloat {
|
||||
get { cornerRadius }
|
||||
set { cornerRadius = newValue }
|
||||
}
|
||||
|
||||
func path(in rect: CGRect) -> Path {
|
||||
let resolvedRadius = min(cornerRadius, min(rect.width, rect.height) / 2)
|
||||
return Path(roundedRect: rect, cornerRadius: resolvedRadius, style: .continuous)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
VStack(spacing: 20) {
|
||||
DynamicIslandPillShape(cornerRadius: 16)
|
||||
.fill(.black)
|
||||
.frame(width: 185, height: 32)
|
||||
|
||||
DynamicIslandPillShape(cornerRadius: 24)
|
||||
.fill(.black)
|
||||
.frame(width: 640, height: 200)
|
||||
}
|
||||
.padding(20)
|
||||
}
|
||||
|
|
@ -606,6 +606,8 @@ struct SettingsView: View {
|
|||
SettingsSearchEntry(tab: .general, title: "Extend hover area", keywords: ["hover", "cursor"], highlightID: SettingsTab.general.highlightID(for: "Extend hover area")),
|
||||
SettingsSearchEntry(tab: .general, title: "Enable haptics", keywords: ["haptic", "feedback"], highlightID: SettingsTab.general.highlightID(for: "Enable haptics")),
|
||||
SettingsSearchEntry(tab: .general, title: "Open notch on hover", keywords: ["hover to open", "auto open"], highlightID: SettingsTab.general.highlightID(for: "Open notch on hover")),
|
||||
SettingsSearchEntry(tab: .general, title: "External display style", keywords: ["dynamic island", "pill", "external display", "non-notch", "floating", "capsule"], highlightID: SettingsTab.general.highlightID(for: "External display style")),
|
||||
SettingsSearchEntry(tab: .general, title: "Hide until hovered", keywords: ["hide", "hover", "external", "non-notch", "auto hide", "slide"], highlightID: SettingsTab.general.highlightID(for: "Hide until hovered")),
|
||||
SettingsSearchEntry(tab: .general, title: "Notch display height", keywords: ["display height", "menu bar size"], highlightID: SettingsTab.general.highlightID(for: "Notch display height")),
|
||||
|
||||
// Live Activities
|
||||
|
|
@ -905,6 +907,8 @@ struct GeneralSettings: View {
|
|||
@Default(.musicGestureBehavior) var musicGestureBehavior
|
||||
@Default(.reverseSwipeGestures) var reverseSwipeGestures
|
||||
@Default(.reverseScrollGestures) var reverseScrollGestures
|
||||
@Default(.externalDisplayStyle) var externalDisplayStyle
|
||||
@Default(.hideNonNotchUntilHover) var hideNonNotchUntilHover
|
||||
|
||||
private func highlightID(_ title: String) -> String {
|
||||
SettingsTab.general.highlightID(for: title)
|
||||
|
|
@ -1118,6 +1122,24 @@ struct GeneralSettings: View {
|
|||
NotificationCenter.default.post(name: Notification.Name.notchHeightChanged, object: nil)
|
||||
}
|
||||
}
|
||||
Picker("External display style", selection: $externalDisplayStyle) {
|
||||
ForEach(ExternalDisplayStyle.allCases) { style in
|
||||
Text(style.localizedName)
|
||||
.tag(style)
|
||||
}
|
||||
}
|
||||
.onChange(of: externalDisplayStyle) {
|
||||
NotificationCenter.default.post(name: Notification.Name.notchHeightChanged, object: nil)
|
||||
}
|
||||
.settingsHighlight(id: highlightID("External display style"))
|
||||
Text(externalDisplayStyle.description)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
Defaults.Toggle("Hide until hovered on non-notch displays", key: .hideNonNotchUntilHover)
|
||||
.settingsHighlight(id: highlightID("Hide until hovered"))
|
||||
Text("When enabled, the notch slides up and hides on external (non-notch) displays until you hover over it.")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
} header: {
|
||||
Text("Notch behavior")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue