mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Worked on custom notch width
This commit is contained in:
parent
b0cc73d33b
commit
75110a92d2
6 changed files with 107 additions and 1 deletions
|
|
@ -2173,6 +2173,8 @@ struct Appearance: View {
|
|||
@Default(.useMusicVisualizer) var useMusicVisualizer
|
||||
@Default(.customVisualizers) var customVisualizers
|
||||
@Default(.selectedVisualizer) var selectedVisualizer
|
||||
@Default(.openNotchWidth) var openNotchWidth
|
||||
@Default(.enableMinimalisticUI) var enableMinimalisticUI
|
||||
let icons: [String] = ["logo2"]
|
||||
@State private var selectedIcon: String = "logo2"
|
||||
@State private var selectedListVisualizer: CustomVisualizer? = nil
|
||||
|
|
@ -2182,6 +2184,9 @@ struct Appearance: View {
|
|||
@State private var url: String = ""
|
||||
@State private var speed: CGFloat = 1.0
|
||||
|
||||
private let notchWidthRange: ClosedRange<Double> = 640...900
|
||||
private let defaultOpenNotchWidth: CGFloat = 640
|
||||
|
||||
private func highlightID(_ title: String) -> String {
|
||||
SettingsTab.appearance.highlightID(for: title)
|
||||
}
|
||||
|
|
@ -2202,6 +2207,8 @@ struct Appearance: View {
|
|||
Text("General")
|
||||
}
|
||||
|
||||
notchWidthControls()
|
||||
|
||||
Section {
|
||||
Defaults.Toggle("Enable colored spectrograms", key: .coloredSpectrogram)
|
||||
.settingsHighlight(id: highlightID("Enable colored spectrograms"))
|
||||
|
|
@ -2463,6 +2470,58 @@ struct Appearance: View {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func notchWidthControls() -> some View {
|
||||
Section {
|
||||
let widthBinding = Binding<Double>(
|
||||
get: { Double(openNotchWidth) },
|
||||
set: { newValue in
|
||||
let clamped = min(max(newValue, notchWidthRange.lowerBound), notchWidthRange.upperBound)
|
||||
let value = CGFloat(clamped)
|
||||
if openNotchWidth != value {
|
||||
openNotchWidth = value
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Slider(
|
||||
value: widthBinding,
|
||||
in: notchWidthRange,
|
||||
step: 10
|
||||
) {
|
||||
HStack {
|
||||
Text("Expanded notch width")
|
||||
Spacer()
|
||||
Text("\(Int(openNotchWidth)) px")
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
.disabled(enableMinimalisticUI)
|
||||
.settingsHighlight(id: highlightID("Expanded notch width"))
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
Button("Reset Width") {
|
||||
openNotchWidth = defaultOpenNotchWidth
|
||||
}
|
||||
.disabled(abs(openNotchWidth - defaultOpenNotchWidth) < 0.5)
|
||||
.buttonStyle(.bordered)
|
||||
}
|
||||
|
||||
let description = enableMinimalisticUI
|
||||
? "Width adjustments apply only to the standard notch layout. Disable Minimalistic UI to edit this value."
|
||||
: "Extend the notch span so the clipboard, colour picker, and other trailing icons remain visible on scaled displays (e.g. More Space)."
|
||||
|
||||
Text(description)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
} header: {
|
||||
Text("Notch Width")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct LockScreenSettings: View {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue