From 0f30c852aba41064226c5eb801c88a774c170a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6khan?= Date: Tue, 25 Aug 2026 00:29:26 +0300 Subject: [PATCH] Carry the remembered front past the Windows paste as well The macOS press learned a third argument, the application that was in front when the recording started, and every backend is handed it. SendInput takes no such thing: nothing on Windows moves the front while a recording runs, so the process id arrives and is left alone. Without this the Windows backend refuses the call the shared press makes, and the five key tests in tests.test_paste.Windows stop at a TypeError. Co-Authored-By: Claude Opus 5 (1M context) --- dikte/paste.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dikte/paste.py b/dikte/paste.py index 8588025..93e7040 100644 --- a/dikte/paste.py +++ b/dikte/paste.py @@ -488,11 +488,14 @@ class _WinInput(ctypes.Structure): _fields_ = [("type", ctypes.c_ulong), ("union", _WinInputUnion)] -def _win_press(shortcut, delay): +def _win_press(shortcut, delay, _focus=None): """Post the presses and releases straight into the input queue. No permission stands in front of SendInput the way Accessibility does on macOS: whatever window has focus receives the combination. + + Nothing here takes the front from the window being dictated into, so the + remembered process id has nothing to hand back to: it is a macOS concern. """ codes = _win_keys(shortcut) user32, _ = _win_api()