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

global listeners for laptop keyboard #6

Closed
MaxPleaner opened this issue Feb 28, 2016 · 4 comments
Closed

global listeners for laptop keyboard #6

MaxPleaner opened this issue Feb 28, 2016 · 4 comments

Comments

@MaxPleaner
Copy link

Hello, I am trying to create a global keyboard-macros program on my personal laptop.

This is Ubuntu 14.04 on a HP EliteBook2540p running Ruby 2.4.0-dev

Currently I have artoo-keyboard working for text that is typed directly into the terminal where the script is running.

I'm trying to have global listeners (so the terminal doesnt have to be in focus).

I've tried specifying the keyboard port using the following:

connection :keyboard, adaptor: :keyboard, port: '/devices/platform/i8042/serio0/input/input3'

I got this port number by running cat /proc/bus/input/devices.

I noticed that if I also include device :keyboard, driver: :keyboard, connection: :keyboard, then the above "connection" call using port has no effect. So I've removed it.

When I try running the script, I get the following trace:

I, [2016-02-27T16:20:01.810087 #3607]  INFO -- : Registering connection 'keyboard'...
I, [2016-02-27T16:20:01.810222 #3607]  INFO -- : Preparing work...
I, [2016-02-27T16:20:01.811240 #3607]  INFO -- : Initializing artoo::connection keyboard...
I, [2016-02-27T16:20:01.819236 #3607]  INFO -- : Starting work...
I, [2016-02-27T16:20:01.819592 #3607]  INFO -- : Connecting to 'keyboard' on port '/devices/platform/i8042/serio0/input/input3'...
E, [2016-02-27T16:20:01.823406 #3607] ERROR -- : Actor crashed!
                                                               NoMethodError: undefined method `name' for "Unknown Command":String
                                                    /home/max/.rbenv/versions/2.4.0-dev/lib/ruby/gems/2.4.0/gems/artoo-1.8.2/lib/artoo/events.rb:10:in `block in on'

I've also tried running the program with sudo but it has the same output.

I'm new to all this hardware business, so I would appreciate knowing if I'm obviously making a mistake somewhere or if my approach is wrong in a serious way.

Thanks

@MaxPleaner MaxPleaner changed the title global keyboard listeners global listeners for laptop keyboard Feb 28, 2016
@deadprogram
Copy link
Member

Hi, @MaxPleaner there is not any current ability for Artoo to listen for keyboard events outside of a terminal window. That would require additional coding beyond what it currently handles. A PR that added this would be happily accepted! :)

@MaxPleaner
Copy link
Author

Hey Ron, thanks for this response. I have no idea how to begin doing this.
If you have any advice for how a solution could be pieced together, I
suppose I might be able to try.

On Sat, Feb 27, 2016 at 6:17 PM, Ron Evans notifications@github.com wrote:

Hi, @MaxPleaner https://github.com/MaxPleaner there is not any current
ability for Artoo to listen for keyboard events outside of a terminal
window. That would require additional coding beyond what it currently
handles. A PR that added this would be happily accepted! :)


Reply to this email directly or view it on GitHub
#6 (comment)
.

@deadprogram
Copy link
Member

Capturing global keyboard events outside of a window focus in a cross-platform way is not going to be easy, I can tell you that...

@MaxPleaner
Copy link
Author

On a Linux platform, it looks like it can be done with evtest. I might put
something together using this, but that approach no longer uses
artoo-keyboard, so i'm fine closing this issue. Thanks for the
code, by the way.

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