mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-29 22:48:37 +00:00
macos: bell-features=title works again
This was a regression we didn't fix before 1.2.
This commit is contained in:
@@ -688,6 +688,8 @@ class BaseTerminalController: NSWindowController,
|
||||
surfaceTree.contains(titleSurface) {
|
||||
// If we have a surface, we want to listen for title changes.
|
||||
titleSurface.$title
|
||||
.combineLatest(titleSurface.$bell)
|
||||
.map { [weak self] in self?.computeTitle(title: $0, bell: $1) ?? "" }
|
||||
.sink { [weak self] in self?.titleDidChange(to: $0) }
|
||||
.store(in: &focusedSurfaceCancellables)
|
||||
} else {
|
||||
@@ -696,7 +698,16 @@ class BaseTerminalController: NSWindowController,
|
||||
}
|
||||
}
|
||||
|
||||
func titleDidChange(to: String) {
|
||||
private func computeTitle(title: String, bell: Bool) -> String {
|
||||
var result = title
|
||||
if (bell && ghostty.config.bellFeatures.contains(.title)) {
|
||||
result = "🔔 \(result)"
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private func titleDidChange(to: String) {
|
||||
guard let window else { return }
|
||||
|
||||
// Set the main window title
|
||||
|
@@ -625,6 +625,7 @@ extension Ghostty.Config {
|
||||
static let audio = BellFeatures(rawValue: 1 << 1)
|
||||
static let attention = BellFeatures(rawValue: 1 << 2)
|
||||
static let title = BellFeatures(rawValue: 1 << 3)
|
||||
static let border = BellFeatures(rawValue: 1 << 4)
|
||||
}
|
||||
|
||||
enum MacDockDropBehavior: String {
|
||||
|
@@ -57,15 +57,6 @@ extension Ghostty {
|
||||
|
||||
@EnvironmentObject private var ghostty: Ghostty.App
|
||||
|
||||
var title: String {
|
||||
var result = surfaceView.title
|
||||
if (surfaceView.bell && ghostty.config.bellFeatures.contains(.title)) {
|
||||
result = "🔔 \(result)"
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
let center = NotificationCenter.default
|
||||
|
||||
|
Reference in New Issue
Block a user