mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
macos: only set quick terminal level to popUpMenu during animation (#5000)
Fixes #4999 We need to set the level to popUpMenu so that we can move the window offscreen and animate it over the main menu, but we must reset it back to floating after the animation is complete so that other higher-level windows can be shown on top of it such as IME windows.
This commit is contained in:
@ -230,6 +230,11 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
// Move our window off screen to the top
|
// Move our window off screen to the top
|
||||||
position.setInitial(in: window, on: screen)
|
position.setInitial(in: window, on: screen)
|
||||||
|
|
||||||
|
// We need to set our window level to a high value. In testing, only
|
||||||
|
// popUpMenu and above do what we want. This gets it above the menu bar
|
||||||
|
// and lets us render off screen.
|
||||||
|
window.level = .popUpMenu
|
||||||
|
|
||||||
// Move it to the visible position since animation requires this
|
// Move it to the visible position since animation requires this
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
window.makeKeyAndOrderFront(nil)
|
window.makeKeyAndOrderFront(nil)
|
||||||
@ -248,6 +253,11 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
// If we canceled our animation in we do nothing
|
// If we canceled our animation in we do nothing
|
||||||
guard self.visible else { return }
|
guard self.visible else { return }
|
||||||
|
|
||||||
|
// After animating in, we reset the window level to a value that
|
||||||
|
// is above other windows but not as high as popUpMenu. This allows
|
||||||
|
// things like IME dropdowns to appear properly.
|
||||||
|
window.level = .floating
|
||||||
|
|
||||||
// Now that the window is visible, sync our appearance. This function
|
// Now that the window is visible, sync our appearance. This function
|
||||||
// requires the window is visible.
|
// requires the window is visible.
|
||||||
self.syncAppearance()
|
self.syncAppearance()
|
||||||
@ -339,6 +349,11 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to set our window level to a high value. In testing, only
|
||||||
|
// popUpMenu and above do what we want. This gets it above the menu bar
|
||||||
|
// and lets us render off screen.
|
||||||
|
window.level = .popUpMenu
|
||||||
|
|
||||||
NSAnimationContext.runAnimationGroup({ context in
|
NSAnimationContext.runAnimationGroup({ context in
|
||||||
context.duration = derivedConfig.quickTerminalAnimationDuration
|
context.duration = derivedConfig.quickTerminalAnimationDuration
|
||||||
context.timingFunction = .init(name: .easeIn)
|
context.timingFunction = .init(name: .easeIn)
|
||||||
|
@ -28,23 +28,5 @@ class QuickTerminalWindow: NSPanel {
|
|||||||
|
|
||||||
// We don't want to activate the owning app when quick terminal is triggered.
|
// We don't want to activate the owning app when quick terminal is triggered.
|
||||||
self.styleMask.insert(.nonactivatingPanel)
|
self.styleMask.insert(.nonactivatingPanel)
|
||||||
|
|
||||||
// We need to set our window level to a high value. In testing, only
|
|
||||||
// popUpMenu and above do what we want. This gets it above the menu bar
|
|
||||||
// and lets us render off screen.
|
|
||||||
self.level = .popUpMenu
|
|
||||||
|
|
||||||
// This plus the level above was what was needed for the animation to work,
|
|
||||||
// because it gets the window off screen properly. Plus we add some fields
|
|
||||||
// we just want the behavior of.
|
|
||||||
self.collectionBehavior = [
|
|
||||||
// We want this to be part of every space because it is a singleton.
|
|
||||||
.canJoinAllSpaces,
|
|
||||||
|
|
||||||
// We don't want to be part of command-tilde
|
|
||||||
.ignoresCycle,
|
|
||||||
|
|
||||||
// We want to show the window on another space if it is visible
|
|
||||||
.fullScreenAuxiliary]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user