macos: more menu items
parent
240d5e0fc5
commit
7835ad0ea4
|
|
@ -48,6 +48,7 @@ class AppDelegate: NSObject,
|
|||
@IBOutlet private var menuFind: NSMenuItem?
|
||||
@IBOutlet private var menuFindNext: NSMenuItem?
|
||||
@IBOutlet private var menuFindPrevious: NSMenuItem?
|
||||
@IBOutlet private var menuHideFindBar: NSMenuItem?
|
||||
|
||||
@IBOutlet private var menuToggleVisibility: NSMenuItem?
|
||||
@IBOutlet private var menuToggleFullScreen: NSMenuItem?
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<outlet property="menuFindParent" destination="cE3-Bt-FcH" id="2dc-ok-hgH"/>
|
||||
<outlet property="menuFindPrevious" destination="1hd-2Z-wVm" id="sSo-wO-2MW"/>
|
||||
<outlet property="menuFloatOnTop" destination="uRj-7z-1Nh" id="94n-o9-Jol"/>
|
||||
<outlet property="menuHideFindBar" destination="xzC-AG-HAc" id="HCo-o6-VWv"/>
|
||||
<outlet property="menuIncreaseFontSize" destination="CIH-ey-Z6x" id="hkc-9C-80E"/>
|
||||
<outlet property="menuMoveSplitDividerDown" destination="Zj7-2W-fdF" id="997-LL-nlN"/>
|
||||
<outlet property="menuMoveSplitDividerLeft" destination="wSR-ny-j1a" id="HCZ-CI-2ob"/>
|
||||
|
|
@ -271,6 +272,13 @@
|
|||
<action selector="findPrevious:" target="-1" id="Zvs-bs-ZR4"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="KlV-2C-wYr"/>
|
||||
<menuItem title="Hide Find Bar" id="xzC-AG-HAc">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="findHide:" target="-1" id="hGP-K9-yN9"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
|
|
|
|||
|
|
@ -1124,6 +1124,10 @@ class BaseTerminalController: NSWindowController,
|
|||
@IBAction func findPrevious(_ sender: Any) {
|
||||
focusedSurface?.findNext(sender)
|
||||
}
|
||||
|
||||
@IBAction func findHide(_ sender: Any) {
|
||||
focusedSurface?.findHide(sender)
|
||||
}
|
||||
|
||||
@objc func resetTerminal(_ sender: Any) {
|
||||
guard let surface = focusedSurface?.surface else { return }
|
||||
|
|
@ -1148,3 +1152,15 @@ class BaseTerminalController: NSWindowController,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension BaseTerminalController: NSMenuItemValidation {
|
||||
func validateMenuItem(_ item: NSMenuItem) -> Bool {
|
||||
switch item.action {
|
||||
case #selector(findHide):
|
||||
return focusedSurface?.searchState != nil
|
||||
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1403,8 +1403,8 @@ class TerminalController: BaseTerminalController, TabGroupCloseCoordinator.Contr
|
|||
|
||||
// MARK: NSMenuItemValidation
|
||||
|
||||
extension TerminalController: NSMenuItemValidation {
|
||||
func validateMenuItem(_ item: NSMenuItem) -> Bool {
|
||||
extension TerminalController {
|
||||
override func validateMenuItem(_ item: NSMenuItem) -> Bool {
|
||||
switch item.action {
|
||||
case #selector(returnToDefaultSize):
|
||||
guard let window else { return false }
|
||||
|
|
@ -1433,7 +1433,7 @@ extension TerminalController: NSMenuItemValidation {
|
|||
return true
|
||||
|
||||
default:
|
||||
return true
|
||||
return super.validateMenuItem(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1494,6 +1494,14 @@ extension Ghostty {
|
|||
AppDelegate.logger.warning("action failed action=\(action)")
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func findHide(_ sender: Any?) {
|
||||
guard let surface = self.surface else { return }
|
||||
let action = "search:"
|
||||
if (!ghostty_surface_binding_action(surface, action, UInt(action.count))) {
|
||||
AppDelegate.logger.warning("action failed action=\(action)")
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func splitRight(_ sender: Any) {
|
||||
guard let surface = self.surface else { return }
|
||||
|
|
@ -1967,6 +1975,9 @@ extension Ghostty.SurfaceView: NSMenuItemValidation {
|
|||
let pb = NSPasteboard.ghosttySelection
|
||||
guard let str = pb.getOpinionatedStringContents() else { return false }
|
||||
return !str.isEmpty
|
||||
|
||||
case #selector(findHide):
|
||||
return searchState != nil
|
||||
|
||||
default:
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in New Issue