diff --git a/input-emulation/src/macos.rs b/input-emulation/src/macos.rs index 881fc229..66cd32ef 100644 --- a/input-emulation/src/macos.rs +++ b/input-emulation/src/macos.rs @@ -452,12 +452,21 @@ impl Emulation for MacOSEmulation { key, state, } => { - let code = match KeyMap::from_key_mapping(KeyMapping::Evdev(key as u16)) { - Ok(k) => k.mac as CGKeyCode, - Err(_) => { - log::warn!("unable to map key event"); - return Ok(()); - } + // Fallback table for Linux evdev keys that have no macOS CGKeyCode in + // the keycode crate's Chromium-derived table. F13/F14/F15 are the + // conventional macOS stand-ins for Print Screen / Scroll Lock / Pause, + // which do not exist on Apple keyboards. + let code: CGKeyCode = match scancode::Linux::try_from(key) { + Ok(scancode::Linux::KeySysrq) => 0x69, // F13 + Ok(scancode::Linux::KeyScrollLock) => 0x6B, // F14 + Ok(scancode::Linux::KeyPause) => 0x71, // F15 + _ => match KeyMap::from_key_mapping(KeyMapping::Evdev(key as u16)) { + Ok(k) => k.mac as CGKeyCode, + Err(_) => { + log::warn!("unable to map key event"); + return Ok(()); + } + }, }; let is_modifier = update_modifiers(&self.modifier_state, key, state); if is_modifier {