diff --git a/libs/enigo/src/win/win_impl.rs b/libs/enigo/src/win/win_impl.rs index 3a6b6215f..091841d43 100644 --- a/libs/enigo/src/win/win_impl.rs +++ b/libs/enigo/src/win/win_impl.rs @@ -350,7 +350,10 @@ impl Enigo { // NOTE VkKeyScanW uses the current keyboard layout // to specify a layout use VkKeyScanExW and GetKeyboardLayout // or load one with LoadKeyboardLayoutW - let keycode_and_shiftstate = unsafe { VkKeyScanW(chr as _) }; + let current_window_thread_id = + unsafe { GetWindowThreadProcessId(GetForegroundWindow(), std::ptr::null_mut()) }; + let layout = unsafe { GetKeyboardLayout(current_window_thread_id) }; + let keycode_and_shiftstate = unsafe { VkKeyScanExW(chr as _, layout) }; keycode_and_shiftstate as _ } else { 0 diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 48efad17e..bd818feac 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -323,6 +323,12 @@ impl Handler { Key::CapsLock | Key::NumLock | Key::ScrollLock => { return; } + Key::Home => Some(ControlKey::Home), + Key::End => Some(ControlKey::End), + Key::Insert => Some(ControlKey::Insert), + Key::PageUp => Some(ControlKey::PageUp), + Key::PageDown => Some(ControlKey::PageDown), + Key::Pause => Some(ControlKey::Pause), _ => None, }; let mut key_event = KeyEvent::new();