Currently when sending keystrokes (e.g. via pyautogui.press()), they go to the system as a whole. Problem here is that if the focused window switches (e.g. user hits Alt-Tab), the keystrokes start going to the new window, which can create havoc.
It would be nice to have the option to send keystrokes to only a specific processes. I've only looked on Mac so far, but it seems like using CGEventPostToPSN instead of CGEventPost might be able to accomplish this there. Not sure about the other platforms, but I imagine it should be possible to do there as well.
I might be able to help out with some PRs, however before diving into that I'd like to know if this is something you would consider or not. I imagine you have some ideas on where to take something like this and I'd hate to go off on a tangent and have to rewrite a bunch of stuff. ;]
Currently when sending keystrokes (e.g. via
pyautogui.press()
), they go to the system as a whole. Problem here is that if the focused window switches (e.g. user hits Alt-Tab), the keystrokes start going to the new window, which can create havoc.It would be nice to have the option to send keystrokes to only a specific processes. I've only looked on Mac so far, but it seems like using
CGEventPostToPSN
instead ofCGEventPost
might be able to accomplish this there. Not sure about the other platforms, but I imagine it should be possible to do there as well.I might be able to help out with some PRs, however before diving into that I'd like to know if this is something you would consider or not. I imagine you have some ideas on where to take something like this and I'd hate to go off on a tangent and have to rewrite a bunch of stuff. ;]