mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-30 06:58:38 +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) {
|
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 {
|
||||||
@@ -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 }
|
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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user