rename slide to quick terminal

This commit is contained in:
Mitchell Hashimoto
2024-09-28 15:20:24 -07:00
parent e3b340c6d3
commit 1570ef01a7
14 changed files with 89 additions and 80 deletions

View File

@ -507,7 +507,7 @@ typedef enum {
GHOSTTY_ACTION_TOGGLE_FULLSCREEN, GHOSTTY_ACTION_TOGGLE_FULLSCREEN,
GHOSTTY_ACTION_TOGGLE_TAB_OVERVIEW, GHOSTTY_ACTION_TOGGLE_TAB_OVERVIEW,
GHOSTTY_ACTION_TOGGLE_WINDOW_DECORATIONS, GHOSTTY_ACTION_TOGGLE_WINDOW_DECORATIONS,
GHOSTTY_ACTION_TOGGLE_SLIDE_TERMINAL, GHOSTTY_ACTION_TOGGLE_QUICK_TERMINAL,
GHOSTTY_ACTION_GOTO_TAB, GHOSTTY_ACTION_GOTO_TAB,
GHOSTTY_ACTION_GOTO_SPLIT, GHOSTTY_ACTION_GOTO_SPLIT,
GHOSTTY_ACTION_RESIZE_SPLIT, GHOSTTY_ACTION_RESIZE_SPLIT,

View File

@ -62,10 +62,10 @@
A5CBD0562C9E65B80017A1AE /* DraggableWindowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0552C9E65A50017A1AE /* DraggableWindowView.swift */; }; A5CBD0562C9E65B80017A1AE /* DraggableWindowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0552C9E65A50017A1AE /* DraggableWindowView.swift */; };
A5CBD0582C9F30960017A1AE /* Cursor.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0572C9F30860017A1AE /* Cursor.swift */; }; A5CBD0582C9F30960017A1AE /* Cursor.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0572C9F30860017A1AE /* Cursor.swift */; };
A5CBD0592C9F37B10017A1AE /* Backport.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CEAFFE29C2410700646FDA /* Backport.swift */; }; A5CBD0592C9F37B10017A1AE /* Backport.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CEAFFE29C2410700646FDA /* Backport.swift */; };
A5CBD05C2CA0C5C70017A1AE /* SlideTerminal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A5CBD05B2CA0C5C70017A1AE /* SlideTerminal.xib */; }; A5CBD05C2CA0C5C70017A1AE /* QuickTerminal.xib in Resources */ = {isa = PBXBuildFile; fileRef = A5CBD05B2CA0C5C70017A1AE /* QuickTerminal.xib */; };
A5CBD05E2CA0C5EC0017A1AE /* SlideTerminalController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD05D2CA0C5E70017A1AE /* SlideTerminalController.swift */; }; A5CBD05E2CA0C5EC0017A1AE /* QuickTerminalController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD05D2CA0C5E70017A1AE /* QuickTerminalController.swift */; };
A5CBD0602CA0C90A0017A1AE /* SlideTerminalWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD05F2CA0C9080017A1AE /* SlideTerminalWindow.swift */; }; A5CBD0602CA0C90A0017A1AE /* QuickTerminalWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD05F2CA0C9080017A1AE /* QuickTerminalWindow.swift */; };
A5CBD0642CA122E70017A1AE /* SlideTerminalPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0632CA122E70017A1AE /* SlideTerminalPosition.swift */; }; A5CBD0642CA122E70017A1AE /* QuickTerminalPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD0632CA122E70017A1AE /* QuickTerminalPosition.swift */; };
A5CBD06B2CA322430017A1AE /* GlobalEventTap.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD06A2CA322320017A1AE /* GlobalEventTap.swift */; }; A5CBD06B2CA322430017A1AE /* GlobalEventTap.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CBD06A2CA322320017A1AE /* GlobalEventTap.swift */; };
A5CC36132C9CD72D004D6760 /* SecureInputOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CC36122C9CD729004D6760 /* SecureInputOverlay.swift */; }; A5CC36132C9CD72D004D6760 /* SecureInputOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CC36122C9CD729004D6760 /* SecureInputOverlay.swift */; };
A5CC36152C9CDA06004D6760 /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CC36142C9CDA03004D6760 /* View+Extension.swift */; }; A5CC36152C9CDA06004D6760 /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5CC36142C9CDA03004D6760 /* View+Extension.swift */; };
@ -138,10 +138,10 @@
A5B3053D299BEAAB0047F10C /* Ghostty.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Ghostty.entitlements; sourceTree = "<group>"; }; A5B3053D299BEAAB0047F10C /* Ghostty.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Ghostty.entitlements; sourceTree = "<group>"; };
A5CBD0552C9E65A50017A1AE /* DraggableWindowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraggableWindowView.swift; sourceTree = "<group>"; }; A5CBD0552C9E65A50017A1AE /* DraggableWindowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraggableWindowView.swift; sourceTree = "<group>"; };
A5CBD0572C9F30860017A1AE /* Cursor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cursor.swift; sourceTree = "<group>"; }; A5CBD0572C9F30860017A1AE /* Cursor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cursor.swift; sourceTree = "<group>"; };
A5CBD05B2CA0C5C70017A1AE /* SlideTerminal.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SlideTerminal.xib; sourceTree = "<group>"; }; A5CBD05B2CA0C5C70017A1AE /* QuickTerminal.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QuickTerminal.xib; sourceTree = "<group>"; };
A5CBD05D2CA0C5E70017A1AE /* SlideTerminalController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlideTerminalController.swift; sourceTree = "<group>"; }; A5CBD05D2CA0C5E70017A1AE /* QuickTerminalController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickTerminalController.swift; sourceTree = "<group>"; };
A5CBD05F2CA0C9080017A1AE /* SlideTerminalWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlideTerminalWindow.swift; sourceTree = "<group>"; }; A5CBD05F2CA0C9080017A1AE /* QuickTerminalWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickTerminalWindow.swift; sourceTree = "<group>"; };
A5CBD0632CA122E70017A1AE /* SlideTerminalPosition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlideTerminalPosition.swift; sourceTree = "<group>"; }; A5CBD0632CA122E70017A1AE /* QuickTerminalPosition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickTerminalPosition.swift; sourceTree = "<group>"; };
A5CBD06A2CA322320017A1AE /* GlobalEventTap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalEventTap.swift; sourceTree = "<group>"; }; A5CBD06A2CA322320017A1AE /* GlobalEventTap.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalEventTap.swift; sourceTree = "<group>"; };
A5CC36122C9CD729004D6760 /* SecureInputOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureInputOverlay.swift; sourceTree = "<group>"; }; A5CC36122C9CD729004D6760 /* SecureInputOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureInputOverlay.swift; sourceTree = "<group>"; };
A5CC36142C9CDA03004D6760 /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; }; A5CC36142C9CDA03004D6760 /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; };
@ -214,7 +214,7 @@
A5CBD0672CA2704E0017A1AE /* Global Keybinds */, A5CBD0672CA2704E0017A1AE /* Global Keybinds */,
A56D58872ACDE6BE00508D2C /* Services */, A56D58872ACDE6BE00508D2C /* Services */,
A59630982AEE1C4400D64628 /* Terminal */, A59630982AEE1C4400D64628 /* Terminal */,
A5CBD05A2CA0C5910017A1AE /* SlideTerminal */, A5CBD05A2CA0C5910017A1AE /* QuickTerminal */,
A5E112912AF73E4D00C6E0C2 /* ClipboardConfirmation */, A5E112912AF73E4D00C6E0C2 /* ClipboardConfirmation */,
A57D79252C9C8782001D522E /* Secure Input */, A57D79252C9C8782001D522E /* Secure Input */,
A534263E2A7DCC5800EBB7A2 /* Settings */, A534263E2A7DCC5800EBB7A2 /* Settings */,
@ -385,15 +385,15 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
A5CBD05A2CA0C5910017A1AE /* SlideTerminal */ = { A5CBD05A2CA0C5910017A1AE /* QuickTerminal */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5CBD05B2CA0C5C70017A1AE /* SlideTerminal.xib */, A5CBD05B2CA0C5C70017A1AE /* QuickTerminal.xib */,
A5CBD05D2CA0C5E70017A1AE /* SlideTerminalController.swift */, A5CBD05D2CA0C5E70017A1AE /* QuickTerminalController.swift */,
A5CBD0632CA122E70017A1AE /* SlideTerminalPosition.swift */, A5CBD0632CA122E70017A1AE /* QuickTerminalPosition.swift */,
A5CBD05F2CA0C9080017A1AE /* SlideTerminalWindow.swift */, A5CBD05F2CA0C9080017A1AE /* QuickTerminalWindow.swift */,
); );
path = SlideTerminal; path = QuickTerminal;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
A5CBD0672CA2704E0017A1AE /* Global Keybinds */ = { A5CBD0672CA2704E0017A1AE /* Global Keybinds */ = {
@ -529,7 +529,7 @@
A5985CE62C33060F00C57AD3 /* man in Resources */, A5985CE62C33060F00C57AD3 /* man in Resources */,
A5A1F8852A489D6800D1E8BC /* terminfo in Resources */, A5A1F8852A489D6800D1E8BC /* terminfo in Resources */,
552964E62B34A9B400030505 /* vim in Resources */, 552964E62B34A9B400030505 /* vim in Resources */,
A5CBD05C2CA0C5C70017A1AE /* SlideTerminal.xib in Resources */, A5CBD05C2CA0C5C70017A1AE /* QuickTerminal.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -555,12 +555,12 @@
A5D0AF3D2B37804400D21823 /* CodableBridge.swift in Sources */, A5D0AF3D2B37804400D21823 /* CodableBridge.swift in Sources */,
A5D0AF3B2B36A1DE00D21823 /* TerminalRestorable.swift in Sources */, A5D0AF3B2B36A1DE00D21823 /* TerminalRestorable.swift in Sources */,
C1F26EA72B738B9900404083 /* NSView+Extension.swift in Sources */, C1F26EA72B738B9900404083 /* NSView+Extension.swift in Sources */,
A5CBD0642CA122E70017A1AE /* SlideTerminalPosition.swift in Sources */, A5CBD0642CA122E70017A1AE /* QuickTerminalPosition.swift in Sources */,
A596309C2AEE1C9E00D64628 /* TerminalController.swift in Sources */, A596309C2AEE1C9E00D64628 /* TerminalController.swift in Sources */,
A5CC36152C9CDA06004D6760 /* View+Extension.swift in Sources */, A5CC36152C9CDA06004D6760 /* View+Extension.swift in Sources */,
A56D58892ACDE6CA00508D2C /* ServiceProvider.swift in Sources */, A56D58892ACDE6CA00508D2C /* ServiceProvider.swift in Sources */,
A5CBD0602CA0C90A0017A1AE /* SlideTerminalWindow.swift in Sources */, A5CBD0602CA0C90A0017A1AE /* QuickTerminalWindow.swift in Sources */,
A5CBD05E2CA0C5EC0017A1AE /* SlideTerminalController.swift in Sources */, A5CBD05E2CA0C5EC0017A1AE /* QuickTerminalController.swift in Sources */,
A51BFC222B2FB6B400E92F16 /* AboutView.swift in Sources */, A51BFC222B2FB6B400E92F16 /* AboutView.swift in Sources */,
A5278A9B2AA05B2600CD3039 /* Ghostty.Input.swift in Sources */, A5278A9B2AA05B2600CD3039 /* Ghostty.Input.swift in Sources */,
A5CBD0562C9E65B80017A1AE /* DraggableWindowView.swift in Sources */, A5CBD0562C9E65B80017A1AE /* DraggableWindowView.swift in Sources */,

View File

@ -49,7 +49,7 @@ class AppDelegate: NSObject,
@IBOutlet private var menuIncreaseFontSize: NSMenuItem? @IBOutlet private var menuIncreaseFontSize: NSMenuItem?
@IBOutlet private var menuDecreaseFontSize: NSMenuItem? @IBOutlet private var menuDecreaseFontSize: NSMenuItem?
@IBOutlet private var menuResetFontSize: NSMenuItem? @IBOutlet private var menuResetFontSize: NSMenuItem?
@IBOutlet private var menuSlideTerminal: NSMenuItem? @IBOutlet private var menuQuickTerminal: NSMenuItem?
@IBOutlet private var menuTerminalInspector: NSMenuItem? @IBOutlet private var menuTerminalInspector: NSMenuItem?
@IBOutlet private var menuEqualizeSplits: NSMenuItem? @IBOutlet private var menuEqualizeSplits: NSMenuItem?
@ -74,8 +74,8 @@ class AppDelegate: NSObject,
/// Manages our terminal windows. /// Manages our terminal windows.
let terminalManager: TerminalManager let terminalManager: TerminalManager
/// Our slide terminal. This starts out uninitialized and only initializes if used. /// Our quick terminal. This starts out uninitialized and only initializes if used.
private var slideController: SlideTerminalController? = nil private var quickController: QuickTerminalController? = nil
/// Manages updates /// Manages updates
let updaterController: SPUStandardUpdaterController let updaterController: SPUStandardUpdaterController
@ -314,7 +314,7 @@ class AppDelegate: NSObject,
syncMenuShortcut(action: "increase_font_size:1", menuItem: self.menuIncreaseFontSize) syncMenuShortcut(action: "increase_font_size:1", menuItem: self.menuIncreaseFontSize)
syncMenuShortcut(action: "decrease_font_size:1", menuItem: self.menuDecreaseFontSize) syncMenuShortcut(action: "decrease_font_size:1", menuItem: self.menuDecreaseFontSize)
syncMenuShortcut(action: "reset_font_size", menuItem: self.menuResetFontSize) syncMenuShortcut(action: "reset_font_size", menuItem: self.menuResetFontSize)
syncMenuShortcut(action: "toggle_slide_terminal", menuItem: self.menuSlideTerminal) syncMenuShortcut(action: "toggle_quick_terminal", menuItem: self.menuQuickTerminal)
syncMenuShortcut(action: "inspector:toggle", menuItem: self.menuTerminalInspector) syncMenuShortcut(action: "inspector:toggle", menuItem: self.menuTerminalInspector)
syncMenuShortcut(action: "toggle_secure_input", menuItem: self.menuSecureInput) syncMenuShortcut(action: "toggle_secure_input", menuItem: self.menuSecureInput)
@ -551,12 +551,12 @@ class AppDelegate: NSObject,
setSecureInput(.toggle) setSecureInput(.toggle)
} }
@IBAction func toggleSlideTerminal(_ sender: Any) { @IBAction func toggleQuickTerminal(_ sender: Any) {
if slideController == nil { if quickController == nil {
slideController = SlideTerminalController(ghostty, baseConfig: nil) quickController = QuickTerminalController(ghostty, baseConfig: nil)
} }
guard let slideController = self.slideController else { return } guard let quickController = self.quickController else { return }
slideController.slideToggle() quickController.toggle()
} }
} }

View File

@ -32,6 +32,7 @@
<outlet property="menuOpenConfig" destination="BOF-NM-1cW" id="Nze-Go-glw"/> <outlet property="menuOpenConfig" destination="BOF-NM-1cW" id="Nze-Go-glw"/>
<outlet property="menuPaste" destination="i27-pK-umN" id="ICc-X2-gV3"/> <outlet property="menuPaste" destination="i27-pK-umN" id="ICc-X2-gV3"/>
<outlet property="menuPreviousSplit" destination="Lic-px-1wg" id="Rto-CG-yRe"/> <outlet property="menuPreviousSplit" destination="Lic-px-1wg" id="Rto-CG-yRe"/>
<outlet property="menuQuickTerminal" destination="kvF-d2-JsP" id="a0u-tf-IEc"/>
<outlet property="menuQuit" destination="4sb-4s-VLi" id="qYN-S1-6UW"/> <outlet property="menuQuit" destination="4sb-4s-VLi" id="qYN-S1-6UW"/>
<outlet property="menuReloadConfig" destination="KKH-XX-5py" id="Wvp-7J-wqX"/> <outlet property="menuReloadConfig" destination="KKH-XX-5py" id="Wvp-7J-wqX"/>
<outlet property="menuResetFontSize" destination="Jah-MY-aLX" id="ger-qM-wrm"/> <outlet property="menuResetFontSize" destination="Jah-MY-aLX" id="ger-qM-wrm"/>
@ -42,7 +43,6 @@
<outlet property="menuSelectSplitLeft" destination="cTK-oy-KuV" id="Jpr-5q-dqz"/> <outlet property="menuSelectSplitLeft" destination="cTK-oy-KuV" id="Jpr-5q-dqz"/>
<outlet property="menuSelectSplitRight" destination="upj-mc-L7X" id="nLY-o1-lky"/> <outlet property="menuSelectSplitRight" destination="upj-mc-L7X" id="nLY-o1-lky"/>
<outlet property="menuServices" destination="aQe-vS-j8Q" id="uWQ-Wo-T1L"/> <outlet property="menuServices" destination="aQe-vS-j8Q" id="uWQ-Wo-T1L"/>
<outlet property="menuSlideTerminal" destination="kvF-d2-JsP" id="cQU-Qt-r5k"/>
<outlet property="menuSplitDown" destination="UDZ-4y-6xL" id="fgZ-Wb-8OR"/> <outlet property="menuSplitDown" destination="UDZ-4y-6xL" id="fgZ-Wb-8OR"/>
<outlet property="menuSplitRight" destination="VUR-Ld-nLx" id="RxO-Zw-ovb"/> <outlet property="menuSplitRight" destination="VUR-Ld-nLx" id="RxO-Zw-ovb"/>
<outlet property="menuTerminalInspector" destination="QwP-M5-fvh" id="wJi-Dh-S9f"/> <outlet property="menuTerminalInspector" destination="QwP-M5-fvh" id="wJi-Dh-S9f"/>
@ -217,10 +217,10 @@
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="L3L-I8-sqk"/> <menuItem isSeparatorItem="YES" id="L3L-I8-sqk"/>
<menuItem title="Slide Terminal" id="kvF-d2-JsP"> <menuItem title="Quick Terminal" id="kvF-d2-JsP">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>
<connections> <connections>
<action selector="toggleSlideTerminal:" target="bbz-4X-AYv" id="9h9-Ge-jgG"/> <action selector="toggleQuickTerminal:" target="bbz-4X-AYv" id="gm3-mk-l8N"/>
</connections> </connections>
</menuItem> </menuItem>
<menuItem isSeparatorItem="YES" id="bC9-n9-RbJ"/> <menuItem isSeparatorItem="YES" id="bC9-n9-RbJ"/>

View File

@ -6,14 +6,14 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="SlideTerminalController" customModule="Ghostty" customModuleProvider="target"> <customObject id="-2" userLabel="File's Owner" customClass="QuickTerminalController" customModule="Ghostty" customModuleProvider="target">
<connections> <connections>
<outlet property="window" destination="QvC-M9-y7g" id="JMU-zX-9Ie"/> <outlet property="window" destination="QvC-M9-y7g" id="JMU-zX-9Ie"/>
</connections> </connections>
</customObject> </customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/> <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="👻 Ghostty" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="SlideTerminalWindow" customModule="Ghostty" customModuleProvider="target"> <window title="👻 Ghostty" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="QuickTerminalWindow" customModule="Ghostty" customModuleProvider="target">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/> <rect key="contentRect" x="196" y="240" width="480" height="270"/>

View File

@ -3,15 +3,15 @@ import Cocoa
import SwiftUI import SwiftUI
import GhosttyKit import GhosttyKit
/// Controller for the slide-style terminal. /// Controller for the "quick" terminal.
class SlideTerminalController: BaseTerminalController { class QuickTerminalController: BaseTerminalController {
override var windowNibName: NSNib.Name? { "SlideTerminal" } override var windowNibName: NSNib.Name? { "QuickTerminal" }
/// The position for the slide terminal. /// The position for the quick terminal.
let position: SlideTerminalPosition let position: QuickTerminalPosition
init(_ ghostty: Ghostty.App, init(_ ghostty: Ghostty.App,
position: SlideTerminalPosition = .top, position: QuickTerminalPosition = .top,
baseConfig base: Ghostty.SurfaceConfiguration? = nil, baseConfig base: Ghostty.SurfaceConfiguration? = nil,
surfaceTree tree: Ghostty.SplitNode? = nil surfaceTree tree: Ghostty.SplitNode? = nil
) { ) {
@ -32,7 +32,7 @@ class SlideTerminalController: BaseTerminalController {
// window close so we can animate out. // window close so we can animate out.
window.delegate = self window.delegate = self
// The slide window is not restorable (yet!). "Yet" because in theory we can // The quick window is not restorable (yet!). "Yet" because in theory we can
// make this restorable, but it isn't currently implemented. // make this restorable, but it isn't currently implemented.
window.isRestorable = false window.isRestorable = false
@ -47,14 +47,14 @@ class SlideTerminalController: BaseTerminalController {
)) ))
// Animate the window in // Animate the window in
slideIn() animateIn()
} }
// MARK: NSWindowDelegate // MARK: NSWindowDelegate
override func windowDidResignKey(_ notification: Notification) { override func windowDidResignKey(_ notification: Notification) {
super.windowDidResignKey(notification) super.windowDidResignKey(notification)
slideOut() animateOut()
} }
func windowWillResize(_ sender: NSWindow, to frameSize: NSSize) -> NSSize { func windowWillResize(_ sender: NSWindow, to frameSize: NSSize) -> NSSize {
@ -67,43 +67,43 @@ class SlideTerminalController: BaseTerminalController {
override func surfaceTreeDidChange(from: Ghostty.SplitNode?, to: Ghostty.SplitNode?) { override func surfaceTreeDidChange(from: Ghostty.SplitNode?, to: Ghostty.SplitNode?) {
super.surfaceTreeDidChange(from: from, to: to) super.surfaceTreeDidChange(from: from, to: to)
// If our surface tree is nil then we slide the window out. // If our surface tree is nil then we animate the window out.
if (to == nil) { if (to == nil) {
slideOut() animateOut()
} }
} }
// MARK: Slide Methods // MARK: Methods
func slideToggle() { func toggle() {
guard let window = self.window else { return } guard let window = self.window else { return }
if (window.alphaValue > 0) { if (window.alphaValue > 0) {
slideOut() animateOut()
} else { } else {
slideIn() animateIn()
} }
} }
func slideIn() { func animateIn() {
guard let window = self.window else { return } guard let window = self.window else { return }
// Animate the window in // Animate the window in
slideWindowIn(window: window, from: position) animateWindowIn(window: window, from: position)
// If our surface tree is nil then we initialize a new terminal. The surface // If our surface tree is nil then we initialize a new terminal. The surface
// tree can be nil if for example we run "eixt" in the terminal and force a // tree can be nil if for example we run "eixt" in the terminal and force
// slide out. // animate out.
if (surfaceTree == nil) { if (surfaceTree == nil) {
surfaceTree = .leaf(.init(ghostty.app!, baseConfig: nil)) surfaceTree = .leaf(.init(ghostty.app!, baseConfig: nil))
} }
} }
func slideOut() { func animateOut() {
guard let window = self.window else { return } guard let window = self.window else { return }
slideWindowOut(window: window, to: position) animateWindowOut(window: window, to: position)
} }
private func slideWindowIn(window: NSWindow, from position: SlideTerminalPosition) { private func animateWindowIn(window: NSWindow, from position: QuickTerminalPosition) {
guard let screen = NSScreen.main else { return } guard let screen = NSScreen.main else { return }
// Move our window off screen to the top // Move our window off screen to the top
@ -121,7 +121,7 @@ class SlideTerminalController: BaseTerminalController {
} }
} }
private func slideWindowOut(window: NSWindow, to position: SlideTerminalPosition) { private func animateWindowOut(window: NSWindow, to position: QuickTerminalPosition) {
guard let screen = NSScreen.main else { return } guard let screen = NSScreen.main else { return }
// Keep track of if we were the key window. If we were the key window then we // Keep track of if we were the key window. If we were the key window then we
@ -164,7 +164,7 @@ class SlideTerminalController: BaseTerminalController {
// MARK: First Responder // MARK: First Responder
@IBAction override func closeWindow(_ sender: Any) { @IBAction override func closeWindow(_ sender: Any) {
// Instead of closing the window, we slide it out. // Instead of closing the window, we animate it out.
slideOut() animateOut()
} }
} }

View File

@ -1,6 +1,6 @@
import Cocoa import Cocoa
enum SlideTerminalPosition { enum QuickTerminalPosition {
case top case top
/// Set the loaded state for a window. /// Set the loaded state for a window.

View File

@ -1,6 +1,6 @@
import Cocoa import Cocoa
class SlideTerminalWindow: NSWindow { class QuickTerminalWindow: NSWindow {
// Both of these must be true for windows without decorations to be able to // Both of these must be true for windows without decorations to be able to
// still become key/main and receive events. // still become key/main and receive events.
override var canBecomeKey: Bool { return true } override var canBecomeKey: Bool { return true }

View File

@ -482,8 +482,8 @@ extension Ghostty {
case GHOSTTY_ACTION_RENDERER_HEALTH: case GHOSTTY_ACTION_RENDERER_HEALTH:
rendererHealth(app, target: target, v: action.action.renderer_health) rendererHealth(app, target: target, v: action.action.renderer_health)
case GHOSTTY_ACTION_TOGGLE_SLIDE_TERMINAL: case GHOSTTY_ACTION_TOGGLE_QUICK_TERMINAL:
toggleSlideTerminal(app, target: target) toggleQuickTerminal(app, target: target)
case GHOSTTY_ACTION_CLOSE_ALL_WINDOWS: case GHOSTTY_ACTION_CLOSE_ALL_WINDOWS:
fallthrough fallthrough
@ -833,12 +833,12 @@ extension Ghostty {
} }
} }
private static func toggleSlideTerminal( private static func toggleQuickTerminal(
_ app: ghostty_app_t, _ app: ghostty_app_t,
target: ghostty_target_s target: ghostty_target_s
) { ) {
guard let appDelegate = NSApplication.shared.delegate as? AppDelegate else { return } guard let appDelegate = NSApplication.shared.delegate as? AppDelegate else { return }
appDelegate.toggleSlideTerminal(self) appDelegate.toggleQuickTerminal(self)
} }
private static func setTitle( private static func setTitle(

View File

@ -324,7 +324,7 @@ pub fn performAction(
.open_config => try rt_app.performAction(.app, .open_config, {}), .open_config => try rt_app.performAction(.app, .open_config, {}),
.reload_config => try self.reloadConfig(rt_app), .reload_config => try self.reloadConfig(rt_app),
.close_all_windows => try rt_app.performAction(.app, .close_all_windows, {}), .close_all_windows => try rt_app.performAction(.app, .close_all_windows, {}),
.toggle_slide_terminal => try rt_app.performAction(.app, .toggle_slide_terminal, {}), .toggle_quick_terminal => try rt_app.performAction(.app, .toggle_quick_terminal, {}),
} }
} }

View File

@ -93,8 +93,8 @@ pub const Action = union(Key) {
/// Toggle whether window directions are shown. /// Toggle whether window directions are shown.
toggle_window_decorations, toggle_window_decorations,
/// Toggle the slide terminal in or out. /// Toggle the quick terminal in or out.
toggle_slide_terminal, toggle_quick_terminal,
/// Jump to a specific tab. Must handle the scenario that the tab /// Jump to a specific tab. Must handle the scenario that the tab
/// value is invalid. /// value is invalid.
@ -179,7 +179,7 @@ pub const Action = union(Key) {
toggle_fullscreen, toggle_fullscreen,
toggle_tab_overview, toggle_tab_overview,
toggle_window_decorations, toggle_window_decorations,
toggle_slide_terminal, toggle_quick_terminal,
goto_tab, goto_tab,
goto_split, goto_split,
resize_split, resize_split,

View File

@ -196,7 +196,7 @@ pub const App = struct {
.close_all_windows, .close_all_windows,
.toggle_tab_overview, .toggle_tab_overview,
.toggle_window_decorations, .toggle_window_decorations,
.toggle_slide_terminal, .toggle_quick_terminal,
.goto_tab, .goto_tab,
.inspector, .inspector,
.render_inspector, .render_inspector,

View File

@ -379,7 +379,7 @@ pub fn performAction(
// Unimplemented // Unimplemented
.close_all_windows, .close_all_windows,
.toggle_split_zoom, .toggle_split_zoom,
.toggle_slide_terminal, .toggle_quick_terminal,
.size_limit, .size_limit,
.cell_size, .cell_size,
.secure_input, .secure_input,

View File

@ -363,16 +363,25 @@ pub const Action = union(enum) {
/// This only works on macOS, since this is a system API on macOS. /// This only works on macOS, since this is a system API on macOS.
toggle_secure_input: void, toggle_secure_input: void,
/// Toggle the "slide" terminal. The slide terminal is a terminal that /// Toggle the "quick" terminal. The quick terminal is a terminal that
/// slides in from some screen edge, usually the top. This is useful for /// appears on demand from a keybinding, often sliding in from a screen
/// quick access to a terminal without having to open a new window or tab. /// edge such as the top. This is useful for quick access to a terminal
/// without having to open a new window or tab.
/// ///
/// The slide terminal is a singleton; only one instance can exist at a /// When the quick terminal loses focus, it disappears. The terminal state
/// time. /// is preserved between appearances, so you can always press the keybinding
/// to bring it back up.
/// ///
/// See the various configurations for the slide terminal in the /// Ths quick terminal has some limitations:
///
/// - It is a singleton; only one instance can exist at a time.
/// - It does not support tabs.
/// - It will not be restored when the application is restarted
/// (for systems that support window restoration).
///
/// See the various configurations for the quick terminal in the
/// configuration file to customize its behavior. /// configuration file to customize its behavior.
toggle_slide_terminal: void, toggle_quick_terminal: void,
/// Quit ghostty. /// Quit ghostty.
quit: void, quit: void,
@ -393,7 +402,7 @@ pub const Action = union(enum) {
/// ///
crash: CrashThread, crash: CrashThread,
pub const SlideTerminalPosition = enum { pub const QuickTerminalPosition = enum {
top, top,
}; };
@ -578,7 +587,7 @@ pub const Action = union(enum) {
.reload_config, .reload_config,
.close_all_windows, .close_all_windows,
.quit, .quit,
.toggle_slide_terminal, .toggle_quick_terminal,
=> .app, => .app,
// These are app but can be special-cased in a surface context. // These are app but can be special-cased in a surface context.