diff --git a/wezterm-gui/src/overlay/launcher.rs b/wezterm-gui/src/overlay/launcher.rs index 13581430f..17e2e0310 100644 --- a/wezterm-gui/src/overlay/launcher.rs +++ b/wezterm-gui/src/overlay/launcher.rs @@ -328,7 +328,12 @@ pub fn launcher( continue; } key_entries.push(Entry { - label: format!("{:?} ({:?} {:?})", assignment, keycode, mods), + label: format!( + "{:?} ({} {})", + assignment, + mods.to_string(), + keycode.to_string() + ), kind: EntryKind::KeyAssignment(assignment), }); } diff --git a/wezterm-input-types/src/lib.rs b/wezterm-input-types/src/lib.rs index 7741c5688..8c186714f 100644 --- a/wezterm-input-types/src/lib.rs +++ b/wezterm-input-types/src/lib.rs @@ -301,7 +301,8 @@ impl ToString for KeyCode { fn to_string(&self) -> String { match self { Self::RawCode(n) => format!("raw:{}", n), - Self::Char(c) => c.to_string(), + Self::Char(c) => format!("mapped:{}", c), + Self::Physical(phys) => format!("{}", phys.to_string()), Self::Composed(s) => s.to_string(), Self::Numpad(n) => format!("Numpad{}", n), Self::Function(n) => format!("F{}", n), @@ -767,6 +768,16 @@ impl TryFrom<&str> for PhysKeyCode { } } +impl ToString for PhysKeyCode { + fn to_string(&self) -> String { + if let Some(s) = INV_PHYSKEYCODE_MAP.get(self) { + s.to_string() + } else { + format!("{:?}", self) + } + } +} + bitflags! { #[derive(Default)] pub struct MouseButtons: u8 {