Merge pull request #2490 from futurepaul/quick-terminal-improvements

macos: quick terminal animate duration
This commit is contained in:
Mitchell Hashimoto
2024-10-25 20:48:40 -07:00
committed by GitHub
3 changed files with 15 additions and 2 deletions

View File

@ -197,7 +197,7 @@ class QuickTerminalController: BaseTerminalController {
// Run the animation that moves our window into the proper place and makes
// it visible.
NSAnimationContext.runAnimationGroup({ context in
context.duration = 0.2
context.duration = ghostty.config.quickTerminalAnimationDuration
context.timingFunction = .init(name: .easeIn)
position.setFinal(in: window.animator(), on: screen)
}, completionHandler: {
@ -287,7 +287,7 @@ class QuickTerminalController: BaseTerminalController {
}
NSAnimationContext.runAnimationGroup({ context in
context.duration = 0.2
context.duration = ghostty.config.quickTerminalAnimationDuration
context.timingFunction = .init(name: .easeIn)
position.setInitial(in: window.animator(), on: screen)
}, completionHandler: {

View File

@ -354,6 +354,14 @@ extension Ghostty {
let str = String(cString: ptr)
return QuickTerminalScreen(fromGhosttyConfig: str) ?? .main
}
var quickTerminalAnimationDuration: Double {
guard let config = self.config else { return 0.2 }
var v: Double = 0.2
let key = "quick-terminal-animation-duration"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v
}
#endif
var resizeOverlay: ResizeOverlay {

View File

@ -1270,6 +1270,11 @@ keybind: Keybinds = .{},
/// by the operating system.
@"quick-terminal-screen": QuickTerminalScreen = .main,
/// Duration (in seconds) of the quick terminal enter and exit animation.
/// Set it to 0 to disable animation completely. This can be changed at
/// runtime.
@"quick-terminal-animation-duration": f64 = 0.2,
/// Whether to enable shell integration auto-injection or not. Shell integration
/// greatly enhances the terminal experience by enabling a number of features:
///