diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift index 29bf9d5395..68f45ae15f 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift @@ -67,7 +67,7 @@ class QuickTerminalController: BaseTerminalController { syncAppearance() // Setup our initial size based on our configured position - position.setLoaded(window) + position.setLoaded(window, size: ghostty.config.quickTerminalSize) // Setup our content window.contentView = NSHostingView(rootView: TerminalView( diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalPosition.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalPosition.swift index 51b4507000..d330b6c964 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalPosition.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalPosition.swift @@ -7,7 +7,7 @@ enum QuickTerminalPosition : String { case right /// Set the loaded state for a window. - func setLoaded(_ window: NSWindow) { + func setLoaded(_ window: NSWindow, size: Double) { guard let screen = window.screen ?? NSScreen.main else { return } switch (self) { case .top, .bottom: @@ -15,14 +15,14 @@ enum QuickTerminalPosition : String { origin: window.frame.origin, size: .init( width: screen.frame.width, - height: screen.frame.height / 4) + height: screen.frame.height * CGFloat(size)) ), display: false) case .left, .right: window.setFrame(.init( origin: window.frame.origin, size: .init( - width: screen.frame.width / 4, + width: screen.frame.width / CGFloat(size), height: screen.frame.height) ), display: false) } diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index 99e08bf9d7..b5b0a16635 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -382,6 +382,14 @@ extension Ghostty { let str = String(cString: ptr) return QuickTerminalScreen(fromGhosttyConfig: str) ?? .main } + + var quickTerminalSize: Double { + guard let config = self.config else { return 0.25 } + var v: Double = 0.25 + let key = "quick-terminal-size" + _ = ghostty_config_get(config, &v, key, UInt(key.count)) + return v + } #endif var resizeOverlay: ResizeOverlay { diff --git a/src/config/Config.zig b/src/config/Config.zig index 4a2f789bf6..cd589426f0 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1266,6 +1266,21 @@ keybind: Keybinds = .{}, /// by the operating system. @"quick-terminal-screen": QuickTerminalScreen = .main, +/// This size of the quick terminal screen based on the quick-terminal-position. +/// +/// This value should be a floating-point number between 0 and 1, +/// where 1 means it occupies the entire screen. +/// +/// The default value is 0.25, meaning the quick terminal will occupy 25% +/// of the screen's dimension. When quick-terminal-position is set to `left` or `right`, +/// the dimension is the screen's width. When quick-terminal-position is set to `top` or `bottom`, +/// the dimension is the screen's height. +/// +/// Examples: +/// * Setting to 0.5 will make the quick terminal occupy 50% of the screen. +/// * Setting to 1 will make it occupy 100% of the screen. +@"quick-terminal-size": f64 = 0.25, + /// Whether to enable shell integration auto-injection or not. Shell integration /// greatly enhances the terminal experience by enabling a number of features: ///