fix: should help with colors getting stuck

This commit is contained in:
Michael Freno
2026-01-14 11:36:14 -05:00
parent 23000589cf
commit 205a889a38
2 changed files with 15 additions and 6 deletions

View File

@@ -11,7 +11,8 @@ extension View {
@ViewBuilder
func glassEffectIfAvailable<S: InsettableShape>(
_ style: GlassStyle,
in shape: S
in shape: S,
colorScheme: ColorScheme? = nil
) -> some View {
if #available(macOS 26.0, *) {
self.glassEffect(style.toGlass(), in: shape)
@@ -40,6 +41,7 @@ extension View {
}
}
.shadow(color: .black.opacity(0.1), radius: 4, x: 0, y: 2)
.id(colorScheme)
}
}
}

View File

@@ -46,6 +46,7 @@ struct MenuBarButtonStyle: ButtonStyle {
}
struct MenuBarHoverButtonStyle: ButtonStyle {
@Environment(\.colorScheme) private var colorScheme
@State private var isHovered = false
func makeBody(configuration: Configuration) -> some View {
@@ -55,7 +56,8 @@ struct MenuBarHoverButtonStyle: ButtonStyle {
isHovered
? GlassStyle.regular.tint(.accentColor).interactive()
: GlassStyle.regular,
in: .rect(cornerRadius: 6)
in: .rect(cornerRadius: 6),
colorScheme: colorScheme
)
.contentShape(Rectangle())
.onHover { hovering in
@@ -318,6 +320,7 @@ struct TimerStatusRowWithIndividualControls: View {
var onDevTrigger: (() -> Void)? = nil
var onTogglePause: (Bool) -> Void
var onTap: (() -> Void)? = nil
@Environment(\.colorScheme) private var colorScheme
@State private var isHoveredSkip = false
@State private var isHoveredDevTrigger = false
@State private var isHoveredBody = false
@@ -433,7 +436,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable(
isHoveredDevTrigger
? GlassStyle.regular.tint(.yellow) : GlassStyle.regular,
in: .circle
in: .circle,
colorScheme: colorScheme
)
.help("Trigger \(displayName) reminder now (dev)")
.accessibilityIdentifier("trigger_\(displayName.replacingOccurrences(of: " ", with: "_"))")
@@ -459,7 +463,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable(
isHoveredPauseButton
? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular,
in: .circle
in: .circle,
colorScheme: colorScheme
)
.help(
isPaused
@@ -480,7 +485,8 @@ struct TimerStatusRowWithIndividualControls: View {
.glassEffectIfAvailable(
isHoveredSkip
? GlassStyle.regular.tint(.accentColor) : GlassStyle.regular,
in: .circle
in: .circle,
colorScheme: colorScheme
)
.help("Skip to next \(displayName) reminder")
.onHover { hovering in
@@ -493,7 +499,8 @@ struct TimerStatusRowWithIndividualControls: View {
isHoveredBody
? GlassStyle.regular.tint(.accentColor)
: GlassStyle.regular,
in: .rect(cornerRadius: 6)
in: .rect(cornerRadius: 6),
colorScheme: colorScheme
)
.padding(.horizontal, 8)
.onHover { hovering in