Skip to content

Commit

Permalink
[macOS] feat: add bring_all_to_front keybinding (ghostty-org#5006)
Browse files Browse the repository at this point in the history
Can't consider the feature complete until the Linux (GTK) implementation
:/ .

Fixes ghostty-org#4704
  • Loading branch information
mitchellh authored Feb 14, 2025
2 parents 686b6a2 + a0f2436 commit 56efaf0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 9 additions & 0 deletions macos/Sources/App/macOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class AppDelegate: NSObject,

@IBOutlet private var menuToggleVisibility: NSMenuItem?
@IBOutlet private var menuToggleFullScreen: NSMenuItem?
@IBOutlet private var menuBringAllToFront: NSMenuItem?
@IBOutlet private var menuZoomSplit: NSMenuItem?
@IBOutlet private var menuPreviousSplit: NSMenuItem?
@IBOutlet private var menuNextSplit: NSMenuItem?
Expand Down Expand Up @@ -763,6 +764,14 @@ class AppDelegate: NSObject,
hiddenState?.restore()
hiddenState = nil
}

@IBAction func bringAllToFront(_ sender: Any) {
if !NSApp.isActive {
NSApp.activate(ignoringOtherApps: true)
}

NSApplication.shared.arrangeInFront(sender)
}

private struct DerivedConfig {
let initialWindow: Bool
Expand Down
14 changes: 8 additions & 6 deletions macos/Sources/App/macOS/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="bbz-4X-AYv" userLabel="AppDelegate" customClass="AppDelegate" customModule="Ghostty" customModuleProvider="target">
<connections>
<outlet property="menuBringAllToFront" destination="LE2-aR-0XJ" id="AP9-oK-60V"/>
<outlet property="menuChangeTitle" destination="24I-xg-qIq" id="kg6-kT-jNL"/>
<outlet property="menuCheckForUpdates" destination="GEA-5y-yzH" id="0nV-Tf-nJQ"/>
<outlet property="menuClose" destination="DVo-aG-piG" id="R3t-0C-aSU"/>
Expand Down Expand Up @@ -278,12 +279,6 @@
<action selector="toggleGhosttyFullScreen:" target="-1" id="QB9-7R-xyc"/>
</connections>
</menuItem>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
<menuItem title="Show/Hide All Terminals" id="DOX-wA-ilh">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down Expand Up @@ -378,6 +373,13 @@
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="dgt-Tx-d4e"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
Expand Down

0 comments on commit 56efaf0

Please sign in to comment.