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

@@ -1874,7 +1874,13 @@ keybind: Keybinds = .{},
/// for instance under the "Sound > Alert Sound" setting in GNOME,
/// or the "Accessibility > System Bell" settings in KDE Plasma.
///
/// Currently only implemented on Linux.
/// On macOS this has no affect.
///
/// On macOS, if the app is unfocused, it will bounce the app icon in the dock
/// once. Additionally, the title of the window with the alerted terminal
/// surface will contain a bell emoji (🔔) until the terminal is focused
/// or a key is pressed. These are not currently configurable since they're
/// considered unobtrusive.
@"bell-features": BellFeatures = .{},
/// Control the in-app notifications that Ghostty shows.