mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-06 19:38:23 +00:00
macos: ability to interrupt animation, track it in menu
This commit is contained in:
@@ -10,6 +10,9 @@ class QuickTerminalController: BaseTerminalController {
|
||||
/// The position for the quick terminal.
|
||||
let position: QuickTerminalPosition
|
||||
|
||||
/// The current state of the quick terminal
|
||||
private(set) var visible: Bool = false
|
||||
|
||||
init(_ ghostty: Ghostty.App,
|
||||
position: QuickTerminalPosition = .top,
|
||||
baseConfig base: Ghostty.SurfaceConfiguration? = nil,
|
||||
@@ -76,8 +79,7 @@ class QuickTerminalController: BaseTerminalController {
|
||||
// MARK: Methods
|
||||
|
||||
func toggle() {
|
||||
guard let window = self.window else { return }
|
||||
if (window.alphaValue > 0) {
|
||||
if (visible) {
|
||||
animateOut()
|
||||
} else {
|
||||
animateIn()
|
||||
@@ -87,6 +89,10 @@ class QuickTerminalController: BaseTerminalController {
|
||||
func animateIn() {
|
||||
guard let window = self.window else { return }
|
||||
|
||||
// Set our visibility state
|
||||
guard !visible else { return }
|
||||
visible = true
|
||||
|
||||
// Animate the window in
|
||||
animateWindowIn(window: window, from: position)
|
||||
|
||||
@@ -100,6 +106,11 @@ class QuickTerminalController: BaseTerminalController {
|
||||
|
||||
func animateOut() {
|
||||
guard let window = self.window else { return }
|
||||
|
||||
// Set our visibility state
|
||||
guard visible else { return }
|
||||
visible = false
|
||||
|
||||
animateWindowOut(window: window, to: position)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user