macOS: Implement basic bell features (no sound)

Fixes #7099

This adds basic bell features to macOS to conceptually match the GTK
implementation. When a bell is triggered, macOS will do the following:

  1. Bounce the dock icon once, if the app isn't already in focus.
  2. Add a bell emoji (🔔) to the title of the surface that triggered
     the bell. This emoji will be removed after the surface is focused
     or a keyboard event if the surface is already focused. This
     behavior matches iTerm2.

This doesn't add an icon badge because macOS's dockTitle.badgeLabel API
wasn't doing anything for me and I wasn't able to fully figure out
why...
This commit is contained in:
Mitchell Hashimoto
2025-04-15 09:47:52 -07:00
parent 392aab2e4a
commit cc690eddb5
8 changed files with 95 additions and 3 deletions

View File

@@ -253,6 +253,9 @@ extension Notification.Name {
/// Resize the window to a default size.
static let ghosttyResetWindowSize = Notification.Name("com.mitchellh.ghostty.resetWindowSize")
/// Ring the bell
static let ghosttyBellDidRing = Notification.Name("com.mitchellh.ghostty.ghosttyBellDidRing")
}
// NOTE: I am moving all of these to Notification.Name extensions over time. This