Add bell feature flags for audio, attention, and title actions on macOS (#7533)

Resolve #7526
This commit is contained in:
Mitchell Hashimoto
2025-06-06 12:59:23 -07:00
committed by GitHub
3 changed files with 10 additions and 5 deletions

View File

@@ -537,11 +537,13 @@ class AppDelegate: NSObject,
}
@objc private func ghosttyBellDidRing(_ notification: Notification) {
// Bounce the dock icon if we're not focused.
NSApp.requestUserAttention(.informationalRequest)
if (ghostty.config.bellFeatures.contains(.attention)) {
// Bounce the dock icon if we're not focused.
NSApp.requestUserAttention(.informationalRequest)
// Handle setting the dock badge based on permissions
ghosttyUpdateBadgeForBell()
// Handle setting the dock badge based on permissions
ghosttyUpdateBadgeForBell()
}
}
private func ghosttyUpdateBadgeForBell() {

View File

@@ -566,6 +566,9 @@ extension Ghostty.Config {
let rawValue: CUnsignedInt
static let system = BellFeatures(rawValue: 1 << 0)
static let audio = BellFeatures(rawValue: 1 << 1)
static let attention = BellFeatures(rawValue: 1 << 2)
static let title = BellFeatures(rawValue: 1 << 3)
}
enum MacHidden : String {

View File

@@ -59,7 +59,7 @@ extension Ghostty {
var title: String {
var result = surfaceView.title
if (surfaceView.bell) {
if (surfaceView.bell && ghostty.config.bellFeatures.contains(.title)) {
result = "🔔 \(result)"
}