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

Generate and listen to global keyboard and mouse events? #42

Open
ufoscout opened this issue Feb 12, 2018 · 3 comments
Open

Generate and listen to global keyboard and mouse events? #42

ufoscout opened this issue Feb 12, 2018 · 3 comments

Comments

@ufoscout
Copy link

I need to write a Go application that can:

  • listen to global keyboard and mouse events
  • generate global keyboard (and maybe mouse) events

When I say "global" I mean that the application runs in background and it should be able to listen to events on whatever window. For example, it should intercept everytime the user presses "ctrl+a" and the emit a series of key presses as if they were pressed by the user on his keyboard.

I wonder if what I need can be achieved with this library.

@BurntSushi
Copy link
Owner

@ufoscout If it can be done using standard X11, then it can be done with this library. That is, if you have an XCB program that does this, then it should be easy to port to XGB. The one exception is if you are using an extension not supported by XGB.

You're on your own for the rest. :-) There are examples in xgbutil you might find helpful: https://github.com/BurntSushi/xgbutil

@ufoscout
Copy link
Author

@BurntSushi thanks for your rapid answer!
My issue is that I know Go but I have absolutely zero experience of C and X11 (and whatever else related to it).
Would it be possible to have a small code example? I checked the link you posted but I am completely lost :(

@BurntSushi
Copy link
Owner

BurntSushi commented Feb 12, 2018 via email

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

2 participants