mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 17:26:09 +03:00
Make equalize_splits
action only affect current window (#6080)
Fixes #6064 https://github.com/user-attachments/assets/bbf393be-de98-41eb-aaad-3a185705ed4c
This commit is contained in:
@ -85,6 +85,12 @@ class TerminalController: BaseTerminalController {
|
|||||||
selector: #selector(onFrameDidChange),
|
selector: #selector(onFrameDidChange),
|
||||||
name: NSView.frameDidChangeNotification,
|
name: NSView.frameDidChangeNotification,
|
||||||
object: nil)
|
object: nil)
|
||||||
|
center.addObserver(
|
||||||
|
self,
|
||||||
|
selector: #selector(onEqualizeSplits),
|
||||||
|
name: Ghostty.Notification.didEqualizeSplits,
|
||||||
|
object: nil
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
@ -859,6 +865,17 @@ class TerminalController: BaseTerminalController {
|
|||||||
toggleFullscreen(mode: fullscreenMode)
|
toggleFullscreen(mode: fullscreenMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func onEqualizeSplits(_ notification: Notification) {
|
||||||
|
guard let target = notification.object as? Ghostty.SurfaceView else { return }
|
||||||
|
|
||||||
|
// Check if target surface is in current controller's tree
|
||||||
|
guard surfaceTree?.contains(view: target) ?? false else { return }
|
||||||
|
|
||||||
|
if case .split(let container) = surfaceTree {
|
||||||
|
_ = container.equalize()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct DerivedConfig {
|
struct DerivedConfig {
|
||||||
let backgroundColor: Color
|
let backgroundColor: Color
|
||||||
let macosTitlebarStyle: String
|
let macosTitlebarStyle: String
|
||||||
|
@ -50,7 +50,6 @@ extension Ghostty {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
let center = NotificationCenter.default
|
let center = NotificationCenter.default
|
||||||
let pubZoom = center.publisher(for: Notification.didToggleSplitZoom)
|
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
|
// 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
|
// ensures that the View stays around so we don't lose our state, but
|
||||||
@ -76,7 +75,6 @@ extension Ghostty {
|
|||||||
container: container
|
container: container
|
||||||
)
|
)
|
||||||
.onReceive(pubZoom) { onZoom(notification: $0) }
|
.onReceive(pubZoom) { onZoom(notification: $0) }
|
||||||
.onReceive(pubEqualize) { onEqualize(notification: $0) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle(surfaceTitle ?? "Ghostty")
|
.navigationTitle(surfaceTitle ?? "Ghostty")
|
||||||
@ -137,11 +135,6 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func onEqualize(notification: SwiftUI.Notification) {
|
|
||||||
guard case .split(let c) = node else { return }
|
|
||||||
_ = c.equalize()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A noSplit leaf node of a split tree.
|
/// A noSplit leaf node of a split tree.
|
||||||
|
Reference in New Issue
Block a user