macos: show the notification count number in the badge

pull/11035/head
Mitchell Hashimoto 2026-02-26 10:20:26 -08:00
parent 5389fdfbaf
commit dcb7c9a4b8
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
1 changed files with 4 additions and 4 deletions

View File

@ -848,11 +848,11 @@ class AppDelegate: NSObject,
}
private func setDockBadge() {
let anyBell = NSApp.windows
let bellCount = NSApp.windows
.compactMap { $0.windowController as? BaseTerminalController }
.contains { $0.bell }
let wantsBadge = ghostty.config.bellFeatures.contains(.attention) && anyBell
let label = wantsBadge ? "" : nil
.reduce(0) { $0 + ($1.bell ? 1 : 0) }
let wantsBadge = ghostty.config.bellFeatures.contains(.attention) && bellCount > 0
let label = wantsBadge ? (bellCount > 99 ? "99+" : String(bellCount)) : nil
NSApp.dockTile.badgeLabel = label
NSApp.dockTile.display()
}