[openbox] Redirecting keyboard input.

Parke parke.nexus at gmail.com
Sat Jun 18 23:35:55 EDT 2016


On Wed, Jun 15, 2016 at 5:39 AM, alex fisher <alexfishersmail at gmail.com> wrote:
> Hi All, I'm looking for some help with a computing issue. I'm running
> Openbox 3.5.2 on Raspbian/Pi3 and a single monitor. I want to have one
> program focused and in fullscreen while the keyboard outputs to another
> unfocused and not visible program. The focused program is Epiphany web
> browser, the un-focused program is an ssh terminal. Thanks for any
> thoughts/suggestions Alex.

Hi Alex,

If you are using the X Window System (which is, of course, what
Openbox runs on), you can virtually "detach" the physical keyboard.
You can then "monitor" events from it, even thought it is virtually
detached.

As for sending the monitored events to an unfocused X-based terminal
emulator, I have no idea how to do that.

I believe I looked at the source code for the xinput program to figure
out how to detach and monitor events.  I believe xinput, from the
command line, can detach and reattach input devices.  I believe it can
also dump to stdout (or stderr?), as diagnostic text, events from
input devices.  I forget if xinput can dump events from detached
devices.

If you play around with virtually detaching keyboards, it is useful to
have two keyboards attached, so that you can still type on one after
virtually detaching the other.

In my case, I wrote a C program that detaches the physical keyboard,
monitors events from that detached physical keyboard,
remaps/translates the events to alternative keystrokes, and then
injects the new events into the "Virtual core XTEST keyboard".  I did
this because I wanted more powerful remapping and chording than I
could accomplish via other means.

Prior to learning that I could virtually detach keyboards, I also
played around with the python-xlib package on Ubuntu (and Debian?).
/usr/share/doc/python-xlib/examples/record_demo.py was the example I
modified.  This let me "record" (monitor) events from an attached
keyboard.  I did this prior to writing the above mentioned C program.
python-xlib is probably less useful for you, given that you want
Epiphany to be focused but not receive keystrokes.

Cheers,

-Parke


More information about the openbox mailing list