diff --git a/wezterm-gui/src/commands.rs b/wezterm-gui/src/commands.rs index 7e593d903..0abafbd70 100644 --- a/wezterm-gui/src/commands.rs +++ b/wezterm-gui/src/commands.rs @@ -271,7 +271,7 @@ fn english_ordinal(n: isize) -> String { /// of metadata that is useful in the command palette/menubar context. /// This function will be called for the result of compute_default_actions(), /// but can also be used to describe user-provided commands -fn derive_command_from_key_assignment(action: &KeyAssignment) -> Option { +pub fn derive_command_from_key_assignment(action: &KeyAssignment) -> Option { Some(match action { PasteFrom(ClipboardPasteSource::PrimarySelection) => CommandDef { brief: "Paste primary selection".into(), diff --git a/wezterm-gui/src/overlay/launcher.rs b/wezterm-gui/src/overlay/launcher.rs index 333de7a2b..247b0bea7 100644 --- a/wezterm-gui/src/overlay/launcher.rs +++ b/wezterm-gui/src/overlay/launcher.rs @@ -5,6 +5,7 @@ //! be rendered as a popup/context menu if the system supports it; at the //! time of writing our window layer doesn't provide an API for context //! menus. +use crate::commands::derive_command_from_key_assignment; use crate::inputmap::InputMap; use crate::termwindow::TermWindowNotif; use config::configuration; @@ -320,13 +321,19 @@ impl LauncherState { // Avoid duplicate entries continue; } - key_entries.push(Entry { - label: format!( + + let label = match derive_command_from_key_assignment(&entry.action) { + Some(cmd) => format!("{}. {}", cmd.brief, cmd.doc), + None => format!( "{:?} ({} {})", entry.action, mods.to_string(), keycode.to_string().escape_debug() ), + }; + + key_entries.push(Entry { + label, action: entry.action, }); }