Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keypresses in other windows #189

Open
d4r3devil opened this issue Oct 25, 2019 · 3 comments
Open

Keypresses in other windows #189

d4r3devil opened this issue Oct 25, 2019 · 3 comments

Comments

@d4r3devil
Copy link

Whenever any key is pressed through keyboard.press () the inputs go to the window where the script is running not the then active window. Is there some method to do this?

@moses-palmer
Copy link
Owner

That sound peculiar. On what platform is this?

My prime suspect would be Linux under Wayland; the Xwayland process simluates an X server, but only for applications launched as X clients. pynput is very limited in this scenario, as it can only interact with other X clients.

@FrostWolf1
Copy link

I'm having this same issue, but on windows. I've looked into it, but have not found anything useful.

@moses-palmer
Copy link
Owner

@FrostWolf1, I attempted reproducing the issue, but failed. I ran the script below from cmd.exe, and then immediately switched focus to notepad.exe.

import pynput, time

time.sleep(3)
pynput.keyboard.Controller().type('Hello world!')

The text Hello world! appeared in the document in notepad.exe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants