native macOS codings agent orchestrator
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix initial Ghostty color scheme sync

+48 -6
+16 -3
supacode/App/GhosttyColorSchemeSyncView.swift
··· 3 3 struct GhosttyColorSchemeSyncView<Content: View>: View { 4 4 @Environment(\.colorScheme) private var colorScheme 5 5 let ghostty: GhosttyRuntime 6 + let preferredColorScheme: ColorScheme? 6 7 let content: Content 7 8 8 - init(ghostty: GhosttyRuntime, @ViewBuilder content: () -> Content) { 9 + init( 10 + ghostty: GhosttyRuntime, 11 + preferredColorScheme: ColorScheme? = nil, 12 + @ViewBuilder content: () -> Content 13 + ) { 9 14 self.ghostty = ghostty 15 + self.preferredColorScheme = preferredColorScheme 10 16 self.content = content() 11 17 } 12 18 13 19 var body: some View { 14 20 content 15 21 .task { 16 - apply(colorScheme) 22 + apply(effectiveColorScheme) 17 23 } 18 24 .onChange(of: colorScheme) { _, newValue in 19 - apply(newValue) 25 + apply(preferredColorScheme ?? newValue) 26 + } 27 + .onChange(of: preferredColorScheme) { _, newValue in 28 + apply(newValue ?? colorScheme) 20 29 } 30 + } 31 + 32 + private var effectiveColorScheme: ColorScheme { 33 + preferredColorScheme ?? colorScheme 21 34 } 22 35 23 36 private func apply(_ scheme: ColorScheme) {
+5 -2
supacode/App/supacodeApp.swift
··· 167 167 preconditionFailure("ghostty_init failed") 168 168 } 169 169 } 170 - let runtime = GhosttyRuntime() 170 + let runtime = GhosttyRuntime(initialColorScheme: initialSettings.appearanceMode.colorScheme) 171 171 _ghostty = State(initialValue: runtime) 172 172 let shortcuts = GhosttyShortcutManager(runtime: runtime) 173 173 _ghosttyShortcuts = State(initialValue: shortcuts) ··· 605 605 606 606 var body: some Scene { 607 607 Window("Prowl", id: "main") { 608 - GhosttyColorSchemeSyncView(ghostty: ghostty) { 608 + GhosttyColorSchemeSyncView( 609 + ghostty: ghostty, 610 + preferredColorScheme: store.settings.appearanceMode.colorScheme 611 + ) { 609 612 ContentView(store: store, terminalManager: terminalManager) 610 613 .environment(ghosttyShortcuts) 611 614 .environment(commandKeyObserver)
+8 -1
supacode/Infrastructure/Ghostty/GhosttyRuntime.swift
··· 48 48 var onConfigChange: (() -> Void)? 49 49 var onQuit: (() -> Void)? 50 50 51 - init() { 51 + init(initialColorScheme: ColorScheme? = nil) { 52 52 guard let config = Self.loadConfig() else { 53 53 preconditionFailure("ghostty_config_new failed") 54 54 } ··· 81 81 preconditionFailure("ghostty_app_new failed") 82 82 } 83 83 self.app = app 84 + if let initialColorScheme { 85 + setColorScheme(initialColorScheme) 86 + } 84 87 85 88 Self.shared = self 86 89 registerNotificationObservers() 90 + } 91 + 92 + var appliedColorSchemeForTesting: ColorScheme? { 93 + currentColorScheme 87 94 } 88 95 89 96 private func registerNotificationObservers() {
+19
supacodeTests/GhosttyRuntimeColorSchemeTests.swift
··· 1 + import SwiftUI 2 + import Testing 3 + 4 + @testable import supacode 5 + 6 + @MainActor 7 + struct GhosttyRuntimeColorSchemeTests { 8 + @Test func initialColorSchemeIsAppliedBeforeSurfacesAreRegistered() { 9 + let runtime = GhosttyRuntime(initialColorScheme: .dark) 10 + 11 + #expect(runtime.appliedColorSchemeForTesting == .dark) 12 + } 13 + 14 + @Test func missingInitialColorSchemeLeavesRuntimeUnspecified() { 15 + let runtime = GhosttyRuntime() 16 + 17 + #expect(runtime.appliedColorSchemeForTesting == nil) 18 + } 19 + }