Is there a class to enable reception of keypresses from command line also?

hi all,
I am wondering - for performance purposes - if it possible to send keypress events to my testApp , from the command line window, apart from sending them from the openGL drawing window…

The reason being. I would like to take mouse focus away from the drawing window (and indeed to a different X screen altogether) , so as to make the projection screen as project-only as possible.

this may also come in handy when remove -controlling the application from an ssh session.
of course it is possible to write another “remote control application” to control my main app, but I am wondering if this is possible too.

thank you for your help.

You can always code up something specific to your OS that will broadcast keypress events (I’ve done something similar here but most OS’s (all that I know of anyways) will only broadcast keypress events to the application window that has focus. What you want sounds more like an OSC or TCP/UDP connection between your app and another application. I’d recommend checking out ofxOSC or ofxNetwork to get an idea of how those work.

this how i do it on the RPI

Edit: This is assuming you are launching the app over ssh. Another way to do it is to have your app listen for a “named pipe”


Hi Jason,

Can you explain the ConsoleListener to me. I’ve tried to implement it as you’ve indicated at the bottom of the .h file, but I can’t seem to capture keypresses from an SSH Console.


Hi Jason,

I figured out that keypresses were actually working from the SSH console, but that I need to press enter to register them. So locally, I can press q, but in the SSH console I have to press ‘q’ then ENTER to have the trigger the keypressed event.

Any ideas? I thought it may have been a terminal emulation setting, but couldn’t see anything in Terminal Preferences.


ENTER is just sending the key. I think another way of doing it is via D-Bus but it is more complex

Hey all!

I know this is an old topic, but I found it when I needed to launch and control an OF app in a rasPi through SSH. The link was broken, so I finally decided to write my own addon to do that and now it is publicly available:

It uses a separated thread to listen to the console without blocking the main thread and you can use it usingOF events or by manually checking if there are new inputs. You can also choose between reading the input line by line or key by key.

I have tested it on Windows and Linux, Raspberry Pi included.

1 Like