native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #102 from supabitapp/fix/transparent-background-surfaces

Fix transparent background rendering in sidebar and setup progress

authored by

khoi and committed by
GitHub
f096175e 292c48e6

+81 -15
+38
supacode/App/ContentView.swift
··· 46 46 .background(.background) 47 47 } 48 48 } 49 + .environment(\.surfaceBackgroundOpacity, terminalManager.surfaceBackgroundOpacity()) 49 50 .onChange(of: scenePhase) { _, newValue in 50 51 store.send(.scenePhaseChanged(newValue)) 51 52 } ··· 101 102 } 102 103 } 103 104 105 + } 106 + 107 + private struct SurfaceBackgroundOpacityKey: EnvironmentKey { 108 + static let defaultValue: Double = 1 109 + } 110 + 111 + extension EnvironmentValues { 112 + var surfaceBackgroundOpacity: Double { 113 + get { self[SurfaceBackgroundOpacityKey.self] } 114 + set { self[SurfaceBackgroundOpacityKey.self] = newValue } 115 + } 116 + 117 + var surfaceTopChromeBackgroundOpacity: Double { 118 + get { 119 + if surfaceBackgroundOpacity < 1 { 120 + let proportionalOpacity = surfaceBackgroundOpacity * 0.56 121 + return min(max(proportionalOpacity, 0.36), 0.62) 122 + } 123 + return 1 124 + } 125 + set { 126 + surfaceBackgroundOpacity = newValue 127 + } 128 + } 129 + 130 + var surfaceBottomChromeBackgroundOpacity: Double { 131 + get { 132 + if surfaceBackgroundOpacity < 1 { 133 + let proportionalOpacity = surfaceBackgroundOpacity * 0.78 134 + return min(max(proportionalOpacity, 0.52), 0.82) 135 + } 136 + return 1 137 + } 138 + set { 139 + surfaceBackgroundOpacity = newValue 140 + } 141 + } 104 142 } 105 143 106 144 private struct RunScriptPromptView: View {
+2 -1
supacode/Features/Repositories/Views/SidebarFooterView.swift
··· 3 3 4 4 struct SidebarFooterView: View { 5 5 let store: StoreOf<RepositoriesFeature> 6 + @Environment(\.surfaceBottomChromeBackgroundOpacity) private var surfaceBottomChromeBackgroundOpacity 6 7 @Environment(\.openURL) private var openURL 7 8 @Environment(CommandKeyObserver.self) private var commandKeyObserver 8 9 ··· 61 62 .padding(.horizontal, 12) 62 63 .padding(.vertical, 8) 63 64 .frame(maxWidth: .infinity, alignment: .leading) 64 - .background(.bar) 65 + .background(Color(nsColor: .windowBackgroundColor).opacity(surfaceBottomChromeBackgroundOpacity)) 65 66 .overlay(alignment: .top) { 66 67 Divider() 67 68 }
+2
supacode/Features/Repositories/Views/WorktreeLoadingView.swift
··· 2 2 3 3 struct WorktreeLoadingView: View { 4 4 let info: WorktreeLoadingInfo 5 + @Environment(\.surfaceBackgroundOpacity) private var surfaceBackgroundOpacity 5 6 private let bottomAnchorID = "worktree-loading-bottom" 6 7 7 8 var body: some View { ··· 59 60 .frame(maxWidth: 640) 60 61 .padding(.horizontal, 16) 61 62 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) 63 + .background(Color(nsColor: .windowBackgroundColor).opacity(surfaceBackgroundOpacity)) 62 64 } 63 65 64 66 private func scrollToBottom(using proxy: ScrollViewProxy, animated: Bool) {
+4
supacode/Features/Terminal/BusinessLogic/WorktreeTerminalManager.swift
··· 228 228 states[worktreeID]?.hasUnseenNotification == true 229 229 } 230 230 231 + func surfaceBackgroundOpacity() -> Double { 232 + runtime.backgroundOpacity() 233 + } 234 + 231 235 private func emit(_ event: TerminalClient.Event) { 232 236 guard let eventContinuation else { 233 237 pendingEvents.append(event)
+11 -5
supacode/Features/Terminal/TabBar/Views/TerminalTabBarBackground.swift
··· 3 3 struct TerminalTabBarBackground: View { 4 4 @Environment(\.controlActiveState) 5 5 private var activeState 6 + @Environment(\.surfaceTopChromeBackgroundOpacity) 7 + private var surfaceTopChromeBackgroundOpacity 6 8 7 9 var body: some View { 8 10 Rectangle() 9 - .fill( 10 - activeState == .inactive 11 - ? TerminalTabBarColors.barBackground.opacity(0.95) 12 - : TerminalTabBarColors.barBackground 13 - ) 11 + .fill(TerminalTabBarColors.barBackground.opacity(chromeBackgroundOpacity)) 12 + } 13 + 14 + private var chromeBackgroundOpacity: Double { 15 + let baseOpacity = surfaceTopChromeBackgroundOpacity 16 + if activeState == .inactive { 17 + return baseOpacity * 0.95 18 + } 19 + return baseOpacity 14 20 } 15 21 }
+11 -2
supacode/Features/Terminal/TabBar/Views/TerminalTabsOverflowShadow.swift
··· 7 7 8 8 @Environment(\.controlActiveState) 9 9 private var activeState 10 + @Environment(\.surfaceTopChromeBackgroundOpacity) 11 + private var surfaceTopChromeBackgroundOpacity 10 12 11 13 var body: some View { 12 14 Rectangle() ··· 19 21 startPoint: startPoint, 20 22 endPoint: endPoint 21 23 ) 22 - .opacity(activeState == .inactive ? 0.95 : 1) 23 24 ) 24 25 .allowsHitTesting(false) 25 26 } 26 27 27 28 private var gradientColors: [Color] { 28 29 [ 29 - TerminalTabBarColors.barBackground, 30 + TerminalTabBarColors.barBackground.opacity(chromeBackgroundOpacity), 30 31 TerminalTabBarColors.barBackground.opacity(0), 31 32 ] 33 + } 34 + 35 + private var chromeBackgroundOpacity: Double { 36 + let baseOpacity = surfaceTopChromeBackgroundOpacity 37 + if activeState == .inactive { 38 + return baseOpacity * 0.95 39 + } 40 + return baseOpacity 32 41 } 33 42 }
+13 -7
supacode/Infrastructure/Ghostty/GhosttySurfaceView.swift
··· 299 299 let opacity = runtime.backgroundOpacity() 300 300 if !window.styleMask.contains(.fullScreen), opacity < 1 { 301 301 window.isOpaque = false 302 + window.titlebarAppearsTransparent = true 302 303 window.backgroundColor = .white.withAlphaComponent(0.001) 303 304 if let app = runtime.app { 304 305 ghostty_set_window_background_blur( ··· 309 310 return 310 311 } 311 312 window.isOpaque = true 313 + window.titlebarAppearsTransparent = false 312 314 window.backgroundColor = runtime.backgroundColor().withAlphaComponent(1) 313 315 } 314 316 ··· 1463 1465 object: scrollView.contentView, 1464 1466 queue: .main 1465 1467 ) { [weak self] _ in 1466 - Task { @MainActor [weak self] in 1468 + MainActor.assumeIsolated { 1467 1469 self?.handleScrollChange() 1468 1470 } 1469 1471 }) ··· 1474 1476 object: scrollView, 1475 1477 queue: .main 1476 1478 ) { [weak self] _ in 1477 - self?.isLiveScrolling = true 1479 + MainActor.assumeIsolated { 1480 + self?.isLiveScrolling = true 1481 + } 1478 1482 }) 1479 1483 1480 1484 observers.append( ··· 1483 1487 object: scrollView, 1484 1488 queue: .main 1485 1489 ) { [weak self] _ in 1486 - self?.isLiveScrolling = false 1490 + MainActor.assumeIsolated { 1491 + self?.isLiveScrolling = false 1492 + } 1487 1493 }) 1488 1494 1489 1495 observers.append( ··· 1492 1498 object: scrollView, 1493 1499 queue: .main 1494 1500 ) { [weak self] _ in 1495 - Task { @MainActor [weak self] in 1501 + MainActor.assumeIsolated { 1496 1502 self?.handleLiveScroll() 1497 1503 } 1498 1504 }) ··· 1501 1507 NotificationCenter.default.addObserver( 1502 1508 forName: NSScroller.preferredScrollerStyleDidChangeNotification, 1503 1509 object: nil, 1504 - queue: nil 1510 + queue: .main 1505 1511 ) { [weak self] _ in 1506 - Task { @MainActor [weak self] in 1512 + MainActor.assumeIsolated { 1507 1513 self?.handleScrollerStyleChange() 1508 1514 } 1509 1515 }) ··· 1514 1520 object: nil, 1515 1521 queue: .main 1516 1522 ) { [weak self] _ in 1517 - Task { @MainActor [weak self] in 1523 + MainActor.assumeIsolated { 1518 1524 self?.refreshAppearance() 1519 1525 } 1520 1526 })