max pleaner
max pleaner

Reputation: 26788

Can I use artoo-keyboard to listen to global keystrokes?

I'm building a text macro application for personal use and am using the artoo and artoo-keyboard gems to listen for keystrokes on my laptop's computer.

The goal is to fire events for global keystrokes, i.e. no particular window needs to be in focus.

Currently it is connected to /dev/ttyS4 and only registers keystrokes made when the terminal is in focus.

The reason I got /dev/ttyS3 is that someone advised I run dmesg | grep tty - this was the result.

With Artoo, the keyboard port is connected to like this:

connection :keyboard, adaptor: :keyboard, port: '/dev/tty/S4'
device :keyboard, driver: :keyboard, connection: :keyboard

Somebody else advised me to run cat /proc/bus/input/devices, and by doing so I see the following entry:

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=sysrq kbd event3 
B: PROP=0
B: EV=120013
B: KEY=20000 20000000020 0 0 1500f02100000 3803078f900d401 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

I'm assuming this is the keyboard entry given the name.

I tried the Artoo connection command using port: 'isa0060/serio0/input0', but the code runs the exact same way.

If it's not clear what I'm trying to accomplish here, take a loot at this 10-second screencast, where I've established a listener to open the artoo.io homepage whenever the text hello world is typed: https://raw.githubusercontent.com/MaxPleaner/keyboard-macros/master/usage_screencast.gif

The problem is that it only works when typing in the terminal.

I am wondering what I can change to get it to work for global keystrokes.

I should mention I'm running Ubuntu 14.04 on a HP EliteBook 2540p laptop.

Upvotes: 0

Views: 83

Answers (1)

max pleaner
max pleaner

Reputation: 26788

The creator of the artoo-keyboard gem responded to me on Github telling me this is impossible.

I make a global keyboard macro program for Linux using evtest and pty.

See http://github.com/maxpleaner/linux-keyboard-macros

Upvotes: 0

Related Questions