Add bell feature flags for audio, attention, and title actions on macOS

Signed-off-by: Aaron Ruan <i@ar212.com>
pull/7533/head
Aaron Ruan 2025-06-06 23:46:06 +08:00
parent 08101b0bc5
commit 5f6a15abef
No known key found for this signature in database
3 changed files with 10 additions and 5 deletions

View File

@ -530,11 +530,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)"
}