Fix terminal notch lifecycle so open/close, hover, outside-click, focus, and opacity stay consistent.

fix: stabilize terminal notch open/close, focus, and opacity

Improve terminal tab behavior in notch by preventing hover re-open races, keeping outside-click close logic accurate, and reliably restoring terminal opacity/translucency after remounts. Also ensure terminal receives focus on open and resigns cleanly on close so keyboard input and close/open cycles behave consistently.
This commit is contained in:
Soham Sharma 2026-04-24 16:31:45 +08:00
commit f39785f920
5 changed files with 128 additions and 14 deletions

View file

@ -1046,13 +1046,21 @@ class AppDelegate: NSObject, NSApplicationDelegate {
closeNotchWorkItem = nil
vm.open()
coordinator.currentView = .terminal
TerminalManager.shared.refreshTerminalAppearanceIfNeeded()
TerminalManager.shared.focusTerminalIfPossible()
TerminalManager.shared.refreshTerminalAppearanceIfNeeded()
} else {
if coordinator.currentView == .terminal {
coordinator.suppressHoverOpen()
TerminalManager.shared.resignTerminalFirstResponderIfNeeded()
vm.close()
} else {
closeNotchWorkItem?.cancel()
closeNotchWorkItem = nil
coordinator.currentView = .terminal
TerminalManager.shared.refreshTerminalAppearanceIfNeeded()
TerminalManager.shared.focusTerminalIfPossible()
TerminalManager.shared.refreshTerminalAppearanceIfNeeded()
}
}
}