gpui: Flash menu in menubar on macOS when action is triggered (#38588)

On macOS, traditionally when a keyboard shortcut is activated, the menu
in the menu bar flashes to indicate that the action was recognised.

<img width="289" height="172" alt="image"
src="https://github.com/user-attachments/assets/a03ecd2f-f159-4f82-b4fd-227f34393703"
/>

This PR adds this functionality to GPUI, where when a keybind is pressed
that triggers an action in the menu, the menu flashes.

Release Notes:

- N/A
This commit is contained in:
Victor Tran
2025-09-24 12:09:03 -07:00
committed by GitHub
parent 8ebe4fa149
commit ed7bd5a8ed
7 changed files with 119 additions and 18 deletions
+3 -1
View File
@@ -1,5 +1,5 @@
use crate::{
AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DevicePixels,
Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DevicePixels,
DummyKeyboardMapper, ForegroundExecutor, Keymap, NoopTextSystem, Platform, PlatformDisplay,
PlatformKeyboardLayout, PlatformKeyboardMapper, PlatformTextSystem, PromptButton,
ScreenCaptureFrame, ScreenCaptureSource, ScreenCaptureStream, SourceMetadata, Task,
@@ -378,6 +378,8 @@ impl Platform for TestPlatform {
fn on_validate_app_menu_command(&self, _callback: Box<dyn FnMut(&dyn crate::Action) -> bool>) {}
fn on_action_triggered(&self, _action: &dyn Action) {}
fn app_path(&self) -> Result<std::path::PathBuf> {
unimplemented!()
}