native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #31 from onevcat/feature/ghostty-quit-close-window-routing

Implement quit and close_window Ghostty action routing

authored by

Wei Wang and committed by
GitHub
1b85d871 2bdaa1db

+25
+3
supacode/App/supacodeApp.swift
··· 153 153 ) 154 154 } 155 155 _store = State(initialValue: appStore) 156 + runtime.onQuit = { [weak appStore] in 157 + appStore?.send(.requestQuit) 158 + } 156 159 appDelegate.appStore = appStore 157 160 SettingsWindowManager.shared.configure( 158 161 store: appStore,
+22
supacode/Infrastructure/Ghostty/GhosttyRuntime.swift
··· 23 23 private var surfaceRefs: [SurfaceReference] = [] 24 24 private var lastColorScheme: ghostty_color_scheme_e? 25 25 var onConfigChange: (() -> Void)? 26 + var onQuit: (() -> Void)? 26 27 27 28 init() { 28 29 guard let config = Self.loadConfig() else { ··· 373 374 openGhosttyConfig() 374 375 return true 375 376 } 377 + if action.tag == GHOSTTY_ACTION_QUIT { 378 + if let runtime = runtime(fromApp: app) { 379 + runtime.onQuit?() 380 + } 381 + return true 382 + } 383 + if action.tag == GHOSTTY_ACTION_CLOSE_WINDOW { 384 + closeWindow(target: target) 385 + return true 386 + } 376 387 guard target.tag == GHOSTTY_TARGET_SURFACE else { return false } 377 388 guard let surface = target.target.surface else { return false } 378 389 guard let bridge = surfaceBridge(fromSurface: surface) else { return false } 379 390 return bridge.handleAction(target: target, action: action) 391 + } 392 + 393 + private static func closeWindow(target: ghostty_target_s) { 394 + switch target.tag { 395 + case GHOSTTY_TARGET_SURFACE: 396 + guard let surface = target.target.surface else { return } 397 + guard let bridge = surfaceBridge(fromSurface: surface) else { return } 398 + bridge.surfaceView?.window?.close() 399 + default: 400 + break 401 + } 380 402 } 381 403 382 404 private static func openGhosttyConfig() {