From 1dc8ce5e95df13209b8611bf90fa59355f56e4d5 Mon Sep 17 00:00:00 2001 From: Erick Navarro Date: Tue, 26 May 2026 20:18:26 -0600 Subject: [PATCH] feat: support CMD as prefix for keybindings in macOS --- src/input/keybindings.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/input/keybindings.rs b/src/input/keybindings.rs index cdf95bf..555d0f4 100644 --- a/src/input/keybindings.rs +++ b/src/input/keybindings.rs @@ -74,16 +74,27 @@ pub fn handle_key( let ctrl = modifiers.state().control_key(); let shift = modifiers.state().shift_key(); let alt = modifiers.state().alt_key(); - handle_key_inner( + + // On macOS, Cmd (super) is the app-shortcut modifier (equivalent to Ctrl elsewhere). + let cmd = cfg!(target_os = "macos") && modifiers.state().super_key(); + + let action = handle_key_inner( &event.logical_key, - ctrl, + ctrl || cmd, shift, alt, mode, grid_cols, grid_rows, application_cursor_keys, - ) + ); + + // macOS: Cmd+key that doesn't match a shortcut is consumed, not forwarded to PTY. + if cmd && !ctrl && matches!(action, Action::SendToPty(_)) { + Action::None + } else { + action + } } pub fn handle_ctrl_w(event: &KeyEvent) -> Action {