From 1f4a2c73189adbb6d59b3a4cbc19379b1f10998b Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Thu, 8 Jan 2026 23:43:58 -0500 Subject: [PATCH] fix: timer row click properly opens in menu --- Gaze/AppDelegate.swift | 6 +- Gaze/Views/MenuBar/MenuBarContentView.swift | 89 +++++++++++---------- Gaze/Views/SettingsWindowView.swift | 5 ++ 3 files changed, 55 insertions(+), 45 deletions(-) diff --git a/Gaze/AppDelegate.swift b/Gaze/AppDelegate.swift index 035a487..3852eb2 100644 --- a/Gaze/AppDelegate.swift +++ b/Gaze/AppDelegate.swift @@ -188,8 +188,12 @@ private func showReminderWindow(_ content: AnyView) { // Public method to open settings window func openSettings(tab: Int = 0) { - // If window already exists, just bring it to front + // If window already exists, switch to the tab and bring it to front if let existingWindow = settingsWindowController?.window { + NotificationCenter.default.post( + name: Notification.Name("SwitchToSettingsTab"), + object: tab + ) existingWindow.makeKeyAndOrderFront(nil) NSApp.activate(ignoringOtherApps: true) return diff --git a/Gaze/Views/MenuBar/MenuBarContentView.swift b/Gaze/Views/MenuBar/MenuBarContentView.swift index eb84912..a3dd3a5 100644 --- a/Gaze/Views/MenuBar/MenuBarContentView.swift +++ b/Gaze/Views/MenuBar/MenuBarContentView.swift @@ -173,9 +173,7 @@ struct TimerStatusRow: View { @State private var isHoveredBody = false var body: some View { - Button(action: { - onTap?() - }) { + HStack { HStack { Image(systemName: type.iconName) .foregroundColor(iconColor) @@ -190,51 +188,54 @@ struct TimerStatusRow: View { .foregroundColor(.secondary) .monospacedDigit() } - + Spacer() - - #if DEBUG - if let onDevTrigger = onDevTrigger { - Button(action: onDevTrigger) { - Image(systemName: "bolt.fill") - .font(.caption) - .foregroundColor(.yellow) - .padding(6) - } - .buttonStyle(.plain) - .glassEffect( - isHoveredDevTrigger ? .regular.tint(.yellow) : .regular, - in: .circle - ) - .help("Trigger \(type.displayName) reminder now (dev)") - .onHover { hovering in - isHoveredDevTrigger = hovering - } - } - #endif - - Button(action: onSkip) { - Image(systemName: "forward.fill") - .font(.caption) - .foregroundColor(.accentColor) - .padding(6) - } - .buttonStyle(.plain) - .glassEffect( - isHoveredSkip ? .regular.tint(.accentColor.opacity(0.5)) : .regular, - in: .circle - ) - .help("Skip to next \(type.displayName) reminder") - .onHover { hovering in - isHoveredSkip = hovering - } } - .padding(.horizontal, 8) - .padding(.vertical, 6) + .contentShape(Rectangle()) + .onTapGesture { + onTap?() + } + + #if DEBUG + if let onDevTrigger = onDevTrigger { + Button(action: onDevTrigger) { + Image(systemName: "bolt.fill") + .font(.caption) + .foregroundColor(.yellow) + .padding(6) + } + .buttonStyle(.plain) + .glassEffect( + isHoveredDevTrigger ? .regular.tint(.yellow) : .regular, + in: .circle + ) + .help("Trigger \(type.displayName) reminder now (dev)") + .onHover { hovering in + isHoveredDevTrigger = hovering + } + } + #endif + + Button(action: onSkip) { + Image(systemName: "forward.fill") + .font(.caption) + .foregroundColor(.accentColor) + .padding(6) + } + .buttonStyle(.plain) + .glassEffect( + isHoveredSkip ? .regular.tint(.accentColor) : .regular, + in: .circle + ) + .help("Skip to next \(type.displayName) reminder") + .onHover { hovering in + isHoveredSkip = hovering + } } - .buttonStyle(.plain) + .padding(.horizontal, 8) + .padding(.vertical, 6) .glassEffect( - isHoveredBody ? .regular.tint(.accentColor.opacity(0.5)) : .regular, + isHoveredBody ? .regular.tint(.accentColor) : .regular, in: .rect(cornerRadius: 6) ) .padding(.horizontal, 8) diff --git a/Gaze/Views/SettingsWindowView.swift b/Gaze/Views/SettingsWindowView.swift index e4c2471..15e84ae 100644 --- a/Gaze/Views/SettingsWindowView.swift +++ b/Gaze/Views/SettingsWindowView.swift @@ -95,6 +95,11 @@ struct SettingsWindowView: View { .padding() } .frame(width: 600, height: 550) + .onReceive(NotificationCenter.default.publisher(for: Notification.Name("SwitchToSettingsTab"))) { notification in + if let tab = notification.object as? Int { + currentTab = tab + } + } } private func applySettings() {