mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Fix: Sneak peek
This commit is contained in:
parent
b46d88c79a
commit
6f4f1ae893
4 changed files with 25 additions and 23 deletions
|
|
@ -87,6 +87,18 @@ struct ContentView: View {
|
||||||
var dynamicNotchSize: CGSize {
|
var dynamicNotchSize: CGSize {
|
||||||
let baseSize = Defaults[.enableMinimalisticUI] ? minimalisticOpenNotchSize : openNotchSize
|
let baseSize = Defaults[.enableMinimalisticUI] ? minimalisticOpenNotchSize : openNotchSize
|
||||||
|
|
||||||
|
// When inline sneak peek is active in closed notch, use the wider inline width
|
||||||
|
// so the outer maxWidth frame doesn't clip the expanded content
|
||||||
|
let inlineSneakPeekActive = vm.notchState == .closed
|
||||||
|
&& coordinator.expandingView.show
|
||||||
|
&& (coordinator.expandingView.type == .music || coordinator.expandingView.type == .timer)
|
||||||
|
&& Defaults[.enableSneakPeek]
|
||||||
|
&& Defaults[.sneakPeekStyles] == .inline
|
||||||
|
if inlineSneakPeekActive {
|
||||||
|
let inlineWidth: CGFloat = 460
|
||||||
|
return CGSize(width: max(baseSize.width, inlineWidth), height: baseSize.height)
|
||||||
|
}
|
||||||
|
|
||||||
if coordinator.currentView == .timer {
|
if coordinator.currentView == .timer {
|
||||||
return CGSize(width: baseSize.width, height: 250) // Extra height for timer presets
|
return CGSize(width: baseSize.width, height: 250) // Extra height for timer presets
|
||||||
}
|
}
|
||||||
|
|
@ -952,37 +964,42 @@ struct ContentView: View {
|
||||||
.fill(.black)
|
.fill(.black)
|
||||||
.frame(width: effectiveCenterWidth, height: notchContentHeight)
|
.frame(width: effectiveCenterWidth, height: notchContentHeight)
|
||||||
.overlay(
|
.overlay(
|
||||||
HStack(alignment: .top){
|
HStack(alignment: .top) {
|
||||||
if(coordinator.expandingView.show && coordinator.expandingView.type == .music) {
|
if(coordinator.expandingView.show && coordinator.expandingView.type == .music) {
|
||||||
MarqueeText(
|
MarqueeText(
|
||||||
.constant(musicManager.songTitle),
|
.constant(musicManager.songTitle),
|
||||||
textColor: Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor) : Color.gray,
|
textColor: Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor) : Color.gray,
|
||||||
minDuration: 0.4,
|
minDuration: 0.4,
|
||||||
frameWidth: 100
|
frameWidth: max(0, (effectiveCenterWidth - vm.closedNotchSize.width) / 2 - 12)
|
||||||
)
|
)
|
||||||
|
.padding(.leading, 8)
|
||||||
.opacity((coordinator.expandingView.show && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
.opacity((coordinator.expandingView.show && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
||||||
Spacer(minLength: vm.closedNotchSize.width)
|
Spacer(minLength: vm.closedNotchSize.width)
|
||||||
Text(musicManager.artistName)
|
Text(musicManager.artistName)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
.foregroundStyle(Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor) : Color.gray)
|
.foregroundStyle(Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor) : Color.gray)
|
||||||
|
.padding(.trailing, 8)
|
||||||
.opacity((coordinator.expandingView.show && coordinator.expandingView.type == .music && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
.opacity((coordinator.expandingView.show && coordinator.expandingView.type == .music && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
||||||
} else if(coordinator.expandingView.show && coordinator.expandingView.type == .timer) {
|
} else if(coordinator.expandingView.show && coordinator.expandingView.type == .timer) {
|
||||||
MarqueeText(
|
MarqueeText(
|
||||||
.constant(timerManager.timerName),
|
.constant(timerManager.timerName),
|
||||||
textColor: timerManager.timerColor,
|
textColor: timerManager.timerColor,
|
||||||
minDuration: 0.4,
|
minDuration: 0.4,
|
||||||
frameWidth: 100
|
frameWidth: max(0, (effectiveCenterWidth - vm.closedNotchSize.width) / 2 - 12)
|
||||||
)
|
)
|
||||||
|
.padding(.leading, 8)
|
||||||
.opacity((coordinator.expandingView.show && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
.opacity((coordinator.expandingView.show && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
||||||
Spacer(minLength: vm.closedNotchSize.width)
|
Spacer(minLength: vm.closedNotchSize.width)
|
||||||
Text(timerManager.formattedRemainingTime())
|
Text(timerManager.formattedRemainingTime())
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.truncationMode(.tail)
|
.truncationMode(.tail)
|
||||||
.foregroundStyle(timerManager.timerColor)
|
.foregroundStyle(timerManager.timerColor)
|
||||||
|
.padding(.trailing, 8)
|
||||||
.opacity((coordinator.expandingView.show && coordinator.expandingView.type == .timer && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
.opacity((coordinator.expandingView.show && coordinator.expandingView.type == .timer && Defaults[.enableSneakPeek] && Defaults[.sneakPeekStyles] == .inline) ? 1 : 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.clipped()
|
||||||
)
|
)
|
||||||
|
|
||||||
musicRightWing(for: secondary, notchHeight: notchContentHeight, trailingWidth: rightWingWidth)
|
musicRightWing(for: secondary, notchHeight: notchContentHeight, trailingWidth: rightWingWidth)
|
||||||
|
|
|
||||||
|
|
@ -297,8 +297,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
// If inline sneak peek is active, use a wider width to accommodate the expanded content
|
// If inline sneak peek is active, use a wider width to accommodate the expanded content
|
||||||
if isInlineSneakPeekActive {
|
if isInlineSneakPeekActive {
|
||||||
// Calculate required width for inline sneak peek:
|
// Calculate required width for inline sneak peek:
|
||||||
// Album art (~32) + Middle section (380) + Visualizer (~32) + padding = ~450
|
// Album art (~32) + Middle section (380) + Visualizer (~32) + horizontal padding (28) + clip shape margin (12)
|
||||||
let inlineSneakPeekWidth: CGFloat = 450
|
let inlineSneakPeekWidth: CGFloat = 460
|
||||||
return CGSize(width: inlineSneakPeekWidth, height: vm.effectiveClosedNotchHeight)
|
return CGSize(width: inlineSneakPeekWidth, height: vm.effectiveClosedNotchHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,11 +513,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
}.store(in: &cancellables)
|
}.store(in: &cancellables)
|
||||||
|
|
||||||
// Observe minimalistic UI setting changes - trigger window resize
|
// Observe minimalistic UI setting changes - trigger window resize
|
||||||
Defaults.publisher(.enableMinimalisticUI, options: []).sink { [weak self] change in
|
Defaults.publisher(.enableMinimalisticUI, options: []).sink { [weak self] _ in
|
||||||
// Force sneak peek to standard mode when minimalistic UI is enabled
|
|
||||||
if change.newValue == true && Defaults[.sneakPeekStyles] != .standard {
|
|
||||||
Defaults[.sneakPeekStyles] = .standard
|
|
||||||
}
|
|
||||||
// Update window size IMMEDIATELY (no debouncing) to prevent position shift
|
// Update window size IMMEDIATELY (no debouncing) to prevent position shift
|
||||||
self?.updateWindowSizeIfNeeded()
|
self?.updateWindowSizeIfNeeded()
|
||||||
}.store(in: &cancellables)
|
}.store(in: &cancellables)
|
||||||
|
|
|
||||||
|
|
@ -22077,6 +22077,7 @@
|
||||||
},
|
},
|
||||||
"Sneak peek style is locked to Standard in minimalistic mode" : {
|
"Sneak peek style is locked to Standard in minimalistic mode" : {
|
||||||
"comment" : "A message displayed when the sneak peek style is locked to standard in minimalistic UI mode.",
|
"comment" : "A message displayed when the sneak peek style is locked to standard in minimalistic UI mode.",
|
||||||
|
"extractionState" : "stale",
|
||||||
"isCommentAutoGenerated" : true,
|
"isCommentAutoGenerated" : true,
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"pt-BR" : {
|
"pt-BR" : {
|
||||||
|
|
|
||||||
|
|
@ -2308,21 +2308,9 @@ struct Media: View {
|
||||||
Text(style.rawValue).tag(style)
|
Text(style.rawValue).tag(style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disabled(!enableSneakPeek || enableMinimalisticUI)
|
.disabled(!enableSneakPeek)
|
||||||
.onChange(of: enableMinimalisticUI) { _, isMinimalistic in
|
|
||||||
// Force standard sneak peek style when minimalistic UI is enabled
|
|
||||||
if isMinimalistic {
|
|
||||||
sneakPeekStyles = .standard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.settingsHighlight(id: highlightID("Sneak Peek Style"))
|
.settingsHighlight(id: highlightID("Sneak Peek Style"))
|
||||||
|
|
||||||
if enableMinimalisticUI {
|
|
||||||
Text("Sneak peek style is locked to Standard in minimalistic mode")
|
|
||||||
.font(.caption)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Stepper(value: $waitInterval, in: 0...10, step: 1) {
|
Stepper(value: $waitInterval, in: 0...10, step: 1) {
|
||||||
HStack {
|
HStack {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue