macos: add key binding for equalizing split sizes

This commit is contained in:
Gregory Anders
2023-11-07 16:15:46 -06:00
parent 36dd5ef4ee
commit cd01340cce
12 changed files with 103 additions and 4 deletions

View File

@@ -50,6 +50,7 @@ extension Ghostty {
var body: some View {
let center = NotificationCenter.default
let pubZoom = center.publisher(for: Notification.didToggleSplitZoom)
let pubEqualize = center.publisher(for: Notification.didEqualizeSplits)
// If we're zoomed, we don't render anything, we are transparent. This
// ensures that the View stays around so we don't lose our state, but
@@ -75,6 +76,7 @@ extension Ghostty {
container: container
)
.onReceive(pubZoom) { onZoom(notification: $0) }
.onReceive(pubEqualize) { onEqualize(notification: $0) }
}
}
.navigationTitle(surfaceTitle ?? "Ghostty")
@@ -135,8 +137,18 @@ extension Ghostty {
}
}
}
func onEqualize(notification: SwiftUI.Notification) {
// If there are no splits then there is nothing to do
switch (node) {
case .split(let c):
_ = c.equalize()
default:
return
}
}
}
/// A noSplit leaf node of a split tree.
private struct TerminalSplitLeaf: View {
/// The leaf to draw the surface for.