Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Sources/Update/UpdateTitlebarAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,27 @@ struct TitlebarControlsView: View {
.background(ShortcutHintPillBackground())
}

private var iconForegroundColor: Color? {
let sidebarVisible = AppDelegate.shared?.sidebarState?.isVisible ?? false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use window-local sidebar visibility for icon tint

iconForegroundColor reads AppDelegate.shared?.sidebarState?.isVisible, but AppDelegate.sidebarState is a single active-window pointer that gets reassigned in setActiveMainWindow (Sources/AppDelegate.swift). TitlebarControlsView is instantiated per window, so in multi-window sessions this can tint icons using another window’s sidebar state (for example, a window with an open sidebar can still get the “sidebar closed” tint when a different window is active), which reintroduces low-contrast icons in the wrong window.

Useful? React with 👍 / 👎.

guard !sidebarVisible else { return nil }
let bg = GhosttyApp.shared.defaultBackgroundColor
return bg.isLightColor
Comment on lines +483 to +486

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bind icon tint to observable state

iconForegroundColor now derives the icon tint from AppDelegate.shared?.sidebarState?.isVisible and GhosttyApp.shared.defaultBackgroundColor, but TitlebarControlsView does not observe either source, so SwiftUI has no guaranteed invalidation when sidebar visibility or Ghostty theme changes. In practice, toggling the sidebar via keyboard/CLI or changing theme at runtime can leave stale icon colors (including the original invisible-on-dark case) until an unrelated re-render happens (e.g. hover or notification updates).

Useful? React with 👍 / 👎.

? Color.black.opacity(0.55)
: Color.white.opacity(0.65)
}

@ViewBuilder
private func iconLabel(systemName: String, config: TitlebarControlsStyleConfig) -> some View {
let icon = Image(systemName: systemName)
let baseIcon = Image(systemName: systemName)
.font(.system(size: config.iconSize, weight: .semibold))
.frame(width: config.buttonSize, height: config.buttonSize)
let icon = Group {
if let color = iconForegroundColor {
baseIcon.foregroundColor(color)
} else {
baseIcon
}
}

if config.buttonBackground {
icon
Expand Down