refactor: improve asynchronous delay by delegating window/app activation process to animateIn

This commit is contained in:
himura467
2025-09-29 02:02:42 +09:00
parent 7ab0a7814b
commit a6dd7bbeee

View File

@@ -253,10 +253,14 @@ class QuickTerminalController: BaseTerminalController {
super.focusSurface(view) super.focusSurface(view)
return return
} }
animateIn() // Check if target surface belongs to this quick terminal
DispatchQueue.main.asyncAfter(deadline: .now() + derivedConfig.quickTerminalAnimationDuration) { guard surfaceTree.contains(view) else { return }
super.focusSurface(view) // Set the target surface as focused before animation
DispatchQueue.main.async {
Ghostty.moveFocus(to: view, from: self.focusedSurface)
} }
// Animation completion handler will handle window/app activation
animateIn()
} }
override func surfaceTreeDidChange(from: SplitTree<Ghostty.SurfaceView>, to: SplitTree<Ghostty.SurfaceView>) { override func surfaceTreeDidChange(from: SplitTree<Ghostty.SurfaceView>, to: SplitTree<Ghostty.SurfaceView>) {