macos: bell-features=title works again (#8766)
This was a regression we didn't fix before 1.2.pull/8768/head
commit
050188fc12
|
|
@ -688,6 +688,8 @@ class BaseTerminalController: NSWindowController,
|
||||||
surfaceTree.contains(titleSurface) {
|
surfaceTree.contains(titleSurface) {
|
||||||
// If we have a surface, we want to listen for title changes.
|
// If we have a surface, we want to listen for title changes.
|
||||||
titleSurface.$title
|
titleSurface.$title
|
||||||
|
.combineLatest(titleSurface.$bell)
|
||||||
|
.map { [weak self] in self?.computeTitle(title: $0, bell: $1) ?? "" }
|
||||||
.sink { [weak self] in self?.titleDidChange(to: $0) }
|
.sink { [weak self] in self?.titleDidChange(to: $0) }
|
||||||
.store(in: &focusedSurfaceCancellables)
|
.store(in: &focusedSurfaceCancellables)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -695,8 +697,17 @@ class BaseTerminalController: NSWindowController,
|
||||||
titleDidChange(to: "👻")
|
titleDidChange(to: "👻")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func computeTitle(title: String, bell: Bool) -> String {
|
||||||
|
var result = title
|
||||||
|
if (bell && ghostty.config.bellFeatures.contains(.title)) {
|
||||||
|
result = "🔔 \(result)"
|
||||||
|
}
|
||||||
|
|
||||||
func titleDidChange(to: String) {
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private func titleDidChange(to: String) {
|
||||||
guard let window else { return }
|
guard let window else { return }
|
||||||
|
|
||||||
// Set the main window title
|
// Set the main window title
|
||||||
|
|
|
||||||
|
|
@ -625,6 +625,7 @@ extension Ghostty.Config {
|
||||||
static let audio = BellFeatures(rawValue: 1 << 1)
|
static let audio = BellFeatures(rawValue: 1 << 1)
|
||||||
static let attention = BellFeatures(rawValue: 1 << 2)
|
static let attention = BellFeatures(rawValue: 1 << 2)
|
||||||
static let title = BellFeatures(rawValue: 1 << 3)
|
static let title = BellFeatures(rawValue: 1 << 3)
|
||||||
|
static let border = BellFeatures(rawValue: 1 << 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MacDockDropBehavior: String {
|
enum MacDockDropBehavior: String {
|
||||||
|
|
|
||||||
|
|
@ -57,15 +57,6 @@ extension Ghostty {
|
||||||
|
|
||||||
@EnvironmentObject private var ghostty: Ghostty.App
|
@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 {
|
var body: some View {
|
||||||
let center = NotificationCenter.default
|
let center = NotificationCenter.default
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue