14
|
1 |
Motivation
|
|
2 |
-----------
|
|
3 |
I wanted to run mplayer, and command things to it using a key bind. I could
|
|
4 |
run "mplayer -slave", but I needed its standard input accessible from any other
|
|
5 |
program. Then, I wrote this program to share stdin.
|
|
6 |
|
|
7 |
|
|
8 |
What does it do
|
|
9 |
-----------------
|
|
10 |
It allows the standard input of a program to be accessible from other terminals
|
|
11 |
through a unix socket, offering also a simple client for this socket.
|
|
12 |
|
|
13 |
|
|
14 |
Exmaple of use
|
|
15 |
-----------------
|
|
16 |
You can try it with 'cat'. In a shell, start "stdinmix cat". Test how 'cat'
|
|
17 |
works; write lines, and see its output.
|
|
18 |
|
|
19 |
From another shell, start "stdinmix", and write there lines. See how they
|
|
20 |
are treated as if they went to 'cat' input. In fact they went to 'cat' input.
|
|
21 |
|
|
22 |
|
|
23 |
How does it work
|
|
24 |
------------------
|
|
25 |
'stdinmix [app]' allow two ways of sending commands to its child application
|
|
26 |
stdin:
|
|
27 |
- using the terminal stdin (as if you run the application alone)
|
|
28 |
- using a unix socket, by default at /tmp/socket-sm.UID, overwritable by
|
|
29 |
the environment variable SM_SOCKET.
|
|
30 |
|
|
31 |
If you don't specify any argument, it will connect to the mentioned unix socket,
|
|
32 |
and forward the current stdin to that socket.
|
|
33 |
|
|
34 |
|
|
35 |
How do I use it
|
|
36 |
------------------
|
|
37 |
I wanted a program for transcribing voice in audio tracks. I had mplayer, and
|
|
38 |
I only needed a way to send commands to it as "-slave". By now, on need,
|
|
39 |
I use xbindkeys [1] to map F1 to "mplayer-remote -p" (pause) and
|
|
40 |
F2 to "mplayer-remote -b" (back a few seconds). Then I can transcribe in
|
|
41 |
my favourite editor (vim) pausing and moving back the audio track when needed.
|
|
42 |
|
|
43 |
|
|
44 |
References
|
|
45 |
------------
|
|
46 |
[1] xbindkeys: http://hocwp.free.fr/xbindkeys/xbindkeys.html
|