You are not logged in.
I've had this idea for some functionality I want to add to sent. It's a stupidly simple program for a presentation.
Basically, I want to have a script/program launch two different instances of sent and display different things on each. The idea behind this being that you could have your main presentation on the projector, while having notes on your computer for you to look at. This requires a lot and I think I've got the rest of it figured out. But I still can't get this part figured out. Is there a way to send one keyboard press to two applications in X through a script/program? There has to be, But I'm not finding any documentation.
Last edited by rasputin (2018-08-31 21:02:01)
Russia's greatest love macine
===============================
PGP Fingerprint: 55A0 40FD A46B DADB
gitlab
Offline
Absolutely. You can do this with xdotool from a script, or use XSendEvent if you are writing your own program (e.g., in C using Xlib).
The problem you may face is how to get that script/program to send those events. Presumably one of your "sent" windows will have focus and they'll receive the key events. So without modifying the code of "sent" you'd not be able to know when to send the event to the other window.
One alternative is to keep focus on your scripts terminal window - but that may be impractical (so you'd have one CLI control interface to two graphical "sent" windows"). Another option would be to write some code that would do a global keyboard grab (XGrabKeyboard) and then dispatch events via XSendEvent to both of the "Sent" windows (you could get their window ids via a call to XQueryTree).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks for the info!! I'm going to work out a bash script to do it, but I'll probably write an actual patch for it later on.
Russia's greatest love macine
===============================
PGP Fingerprint: 55A0 40FD A46B DADB
gitlab
Offline