Skip to content

Commit

Permalink
Merge pull request #2490 from futurepaul/quick-terminal-improvements
Browse files Browse the repository at this point in the history
macos: quick terminal animate duration
  • Loading branch information
mitchellh authored Oct 26, 2024
2 parents 50329e6 + 3c8fc86 commit 734c8ce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
8 changes: 8 additions & 0 deletions macos/Sources/Ghostty/Ghostty.Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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:
///
Expand Down

0 comments on commit 734c8ce

Please sign in to comment.