[Gllug] share keyboard input between two applications

Victor Churchill vchurchill at softwareshack.eu
Fri Oct 9 10:00:04 UTC 2009


2009/10/9 Peter Childs <peterachilds at gmail.com>:
> 2009/10/9 JLMS <jjllmmss at googlemail.com>:
>> On Fri, Oct 9, 2009 at 10:15 AM, Victor Churchill
>> <vchurchill at softwareshack.eu> wrote:
>>> 2009/10/8  <news at aleblanc.cotse.net>:
>>>> Hi,
>>>>   can anyone tell me if it is possible to share keyboard input events
>>>>   between two or more applications simultaneously? and if so, how?
>>>>   I want to try playing music while simultaneously typing text (don't
>>>>   ask why).
>>>>
>>>> --
>>>> aleblanc
>>>>
>>>
>>> Would named pipes made with mkfifo work for you? You can sit in a while loop,
>>> read()ing a line and echoing it onto both fifos . Then have your apps
>>> read their input from the pipes.
>>
>>
>> Explain further please, this sounds enticing, perhaps short snippet of code?
>> --
>
>
> Sounds like a perfect use of tee.
>
> cat - | tee `command 1` | command 2
>
> or somthing like that
>

I wondered about tee too, but couldn't see quite how it would do it.
(Does not help that 'man tee' just gives a brief useage then refers
you to an info page...)
mkfifo PIPE1
mkfifo PIPE2
# read a keybrd line, echo it onto both pipes
while true ; do read xx; echo $xx > PIPE1; echo $xx > PIPE2; echo next:; done &

elsewhere
tail -f PIPE1

elsewhere
tail -f PIPE2




-- 
regards,

Victor Churchill
The Software Shack, Ltd
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list